Graylog: 4. Create the service
This documentation is part of the Automate with the CLI guide. You can view the complete guide here: Start Graylog, retrieve its credentials, and modify its configuration programmatically using the Stackhero CLI.
👋 Welcome to Stackhero documentation
Stackhero offers a fully managed Graylog cloud solution designed for speed and simplicity. You can:
- Count on an unlimited, dedicated SMTP email server included with your service.
- Apply updates easily with a single click, with no manual intervention required.
- Use a custom domain name secured by HTTPS (for example, https://logs.your-company.com), providing your team with secure, direct access.
- Benefit from strong performance and security on a private, dedicated infrastructure with no shared resources or noisy neighbours.
Focus on your data, not your tools: you can get started with Stackhero's Graylog cloud hosting solution in just a few minutes.
Below is a sample script that creates a stack, adds your Graylog service to it, waits for it to start, retrieves its configuration (including generated credentials), and then applies a new configuration.
#!/bin/bash
set -e
export STACKHERO_TOKEN="usr-xxxxxx:your-token"
serviceStore="graylog" # The Graylog service store name (see step 2)
instance="..." # An instance size from step 3
region="europe" # A region name from step 3
# Create a stack for your service (uses your default organization; add --organization if needed)
stackId=$(stackhero --format=script stack-create \
--name="My Graylog stack")
echo "Stack created: ${stackId}"
# Add Graylog to the stack (names are resolved automatically)
serviceId=$(stackhero --format=script service-add \
--stack="My Graylog stack" \
--service-store="${serviceStore}" \
--instance="${instance}" \
--region="${region}")
echo "Service added: graylog"
# Wait for the service to be fully operational (this may take a few minutes)
stackhero service-wait-for --service="graylog"
# Retrieve the service configuration, including generated credentials
stackhero service-configuration-get --service="graylog" --format=json