/fluent-bit-go-loki

[Deprecated] The predessor of fluent-bit output plugin for Loki. https://github.com/grafana/loki

Primary LanguageGoApache License 2.0Apache-2.0

fluent-bit loki output plugin

NOTICE! fluent-bit-go-loki is now merged in loki repository.

Build Status Build status

Windows binaries are available in release pages.

DockerHub base images is available in DockerHub.

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

Or,

$ docker build . -t fluent-bit/loki-plugin

and then, specify Url parameter as environment variable:

$ docker run -it -e="LOKI_URL=http://[YOURHOST]:[YOURPORT]/loki/api/v1/push" fluent-bit/loki-plugin

Using docker image from docker hub.

$ docker pull cosmo0920/fluent-bit-go-loki:latest

Other released images are available in DockerHub's fluent-bit-go-loki image tags.

Prerequisites

  • Go 1.11+
  • gcc (for cgo)
  • make (for Makefile)

Building

$ make

Configuration Options

Key Description Default
Url Url of loki server API endpoint http://localhost:3100/loki/api/v1/push
BatchWait Time to wait before send a log batch to Loki, full or not. (unit: sec) 1 second
BatchSize Log batch size to send a log batch to Loki (unit: Bytes) 10 KiB (10*1024 Bytes)
Labels labels for API requests job="fluent-bit" (describe below)
LogLevel Specify log level info
RemoveKeys Comma separated list of needless record keys to remove. none
LabelKeys Comma separated list of keys to use as stream labels. none

Example:

add this section to fluent-bit.conf

[Output]
    Name loki
    Match *
    Url http://localhost:3100/loki/api/v1/push
    BatchWait 10 # (10msec)
    BatchSize 30 # (30KiB)
    Labels {test="fluent-bit-go",lang="Golang"}
    RemoveKeys key1,key2

Useful links