Zum Inhalt springen

Fluent Bit: Write log data with Loki API

Zuletzt aktualisiert am

Fluent Bit is a popular agent for collecting logs and shipping them to multiple destinations. It has built-in plugin available for Loki as an output which can be configured to target STACKIT Logs instance using Loki API.

Fluent Bit can be configured with the next steps. The conf file output of steps is shown first, you can extend it according to your requirements.

fluent-bit.conf
[OUTPUT]
name loki
host <put-host-name-from-url-of-data-source-in-logs-instance>
port 443
bearer_token <Token value from Logs instance Access Token>
tls on
tls.verify on
  1. Create or edit the fluentbit configuration file usually named fluent-bit.conf
  2. Add an output with name as loki so that it uses Loki format.
  3. In the output set the host key with value of host from STACKIT Logs instance’s data source URL.
  4. Set the port key to 443. Default in the plugin is 3100.
  5. Set the bearer_token key with value of the access token for STACKIT Logs instance. Make sure the token has write permissions.
  6. Enable TLS for the output by setting tls and tls.verify keys with value on.
  7. The fluentbit output is now configured to connect to STACKIT Logs instance.
  8. You can now further configure the output according to your needs. See the configuration of the plugin for more details.