/fluent-bit-go-loki

fluent-bit output plugin for Loki. https://github.com/grafana/loki

Primary LanguageGoApache License 2.0Apache-2.0

fluent-bit loki output plugin

Build Status Build status

Windows binaries are available in release pages.

This plugin works with fluent-bit's go plugin interface. You can use fluent-bit loki to ship logs into grafana datasource with loki.

The configuration typically looks like:

fluent-bit --> loki --> grafana <-- other grafana sources

Usage

$ fluent-bit -e /path/to/built/out_loki.so -c fluent-bit.conf

Prerequisites

  • Go 1.11+
  • gcc (for cgo)

Building

$ make

Configuration Options

Key Description Default
Url Url of loki server API endpoint http://localhost:3100/api/prom/push
BatchWait Waiting time for batch operation (unit: msec) 10 milliseconds
Url Batch size for batch operation (unit: KiB) 10 KiB
Labels labels for API requests job="fluent-bit" (describe below)

Example:

add this section to fluent-bit.conf

[Output]
    Name loki
    Match *
    Url http://localhost:3100/api/prom/push
    BatchWait 10 # (10msec)
    BatchSize 30 # (30KiB)
    # interpreted as {test="fluent-bit-go", lang="Golang"}
    Labels {"labels": [{"key": "test", "label": "fluent-bit-go"},{"key": "lang", "label": "Golang"}]}

Useful links