Configure log forwarding to Graylog

Learn how to configure your Stackhero instances to forward system logs to Graylog for centralised log management.

Graylog offers a robust and intuitive platform for managing system logs. It streamlines the collection, organisation, and analysis of logs, while providing features such as Slack and email notifications, customisable dashboards, and a powerful query interface. This makes it an ideal tool for enhancing monitoring, improving security, and simplifying incident diagnosis.

By configuring your Stackhero instances to forward logs to a Graylog server, you centralise log management, thereby optimising the efficiency and relevance of your system monitoring.

Follow these steps to set up Graylog to receive logs:

  1. Log in to the Graylog web interface.
  2. Go to System > Inputs.
  3. From the Select input dropdown, choose GELF HTTP.
  4. Enable the Global option.
  5. Give the input a descriptive name, such as "GELF HTTPS".
  6. Enable the Enable Bulk Receiving option.
  7. Save the configuration.

The "Enable Bulk Receiving" option is essential. Your Stackhero instance sends several log lines in each request. Without this option, Graylog will only receive the first line of each request and will silently ignore the rest.

If your GELF HTTP input already exists, go to System > Inputs, select Edit input from the menu for that input, and enable Enable Bulk Receiving.

Graylog GELF HTTP Input ConfigurationGraylog GELF HTTP Input Configuration

Next, check the input port settings in your Stackhero dashboard:

  1. Access your Stackhero dashboard.
  2. Go to the configuration page for your Graylog service.
  3. Click on Configure.
  4. Ensure that port 12201 is enabled for both TCP and TLS in the Input Ports section. Adjust the settings if necessary.

Activating TLS on Port 12201 in GraylogActivating TLS on Port 12201 in Graylog

Your Graylog instance is now ready to receive logs from Stackhero.

To configure a Stackhero instance to forward logs to Graylog:

  1. Log in to the Stackhero dashboard.
  2. Go to the service instance you wish to configure.
  3. Select the Logs Forwarder tab.
  4. Enter your Graylog domain in the Graylog Domain field (for example, <XXXXXX>.stackhero-network.com or your custom domain).
  5. Set the Graylog Port to 12201.
  6. Save the configuration.

Once these settings are saved, your Stackhero instance will start forwarding logs to your Graylog server.

Stackhero Logs Forwarder ConfigurationStackhero Logs Forwarder Configuration

To check that logs are being forwarded correctly:

  1. Open the Graylog web interface.
  2. Go to the Search section.
  3. Enter a query, such as "logs from".
  4. Look for log entries from your instance (for example, "Logs from svc-xxxxxx") sent to <XXXXXX>.stackhero-network.com:12201.

Graylog Receiving Logs ExampleGraylog Receiving Logs Example

Congratulations! Your Stackhero instances are now forwarding logs to your Graylog server. This setup enables you to centralise and analyse your logs in a scalable way.