Fluent Bit: Write log data with Loki API
Last updated on
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.
Prerequisites
Section titled “Prerequisites”- You have a STACKIT Logs Instance: Create your first STACKIT Logs instance
- You have credentials with write permission for the STACKIT Logs Instance: Retrieve credentials for STACKIT Logs instance
- Data source URL of the STACKI Logs Instance: Retrieve API URL STACKIT Logs instance
Client Configuration
Section titled “Client Configuration”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.
[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- Create or edit the fluentbit configuration file usually named
fluent-bit.conf - Add an output with name as
lokiso that it uses Loki format. - In the output set the
hostkey with value of host from STACKIT Logs instance’s data source URL. - Set the
portkey to443. Default in the plugin is 3100. - Set the
bearer_tokenkey with value of the access token for STACKIT Logs instance. Make sure the token has write permissions. - Enable TLS for the output by setting
tlsandtls.verifykeys with valueon. - The fluentbit output is now configured to connect to STACKIT Logs instance.
- You can now further configure the output according to your needs. See the configuration of the plugin for more details.