Sending logs to Logtail using Fluentd

Setting up Fluentd is very straightforward:

  1. Install Fluentd on your server according to the documentation  .

  2. Install and set up Fluentd input plugins  to suit your needs (e.g., Syslog  ).

  3. Install the Logtail plugin: td-agent-gem install fluent-plugin-logtail

info

Depending on how you're using Fluentd, you might have to install the plugin gem using fluent-gem instead of td-agent-gem. Read more about Plugin Management  in the Fluentd documentation.

  1. Modify the Fluentd configuration to start sending the logs to your Logtail source. A basic configuration that forwards logs from all inputs to a single Logtail source could look like this:
<match *>
  @type logtail
  @id output_logtail
  source_token YOUR_LOGTAIL_SOURCE_TOKEN
  flush_interval 2 # in seconds
</match>
Copied!
  1. Once you're happy with your configuration, restart the Fluentd service: bash sudo systemctl restart td-agent.service You should start seeing your logs in Logtail 🎉

Make sure to replace <YOUR_LOGTAIL_SOURCE_TOKEN> with your own source token from Logtail.com.