Skip to content

Instantly share code, notes, and snippets.

@jwalton
Created January 12, 2022 18:10
Show Gist options
  • Save jwalton/915d5ab9f382fae056957904ee576dce to your computer and use it in GitHub Desktop.
Save jwalton/915d5ab9f382fae056957904ee576dce to your computer and use it in GitHub Desktop.
Fluent-bit playground
[SERVICE]
flush 5
log_level info
daemon off
parsers_file parsers.conf
[INPUT]
Name tail
Path /test.log
read_from_head true
multiline.parser docker
tag foo.pino.*
[FILTER]
Name multiline
match *.pino.*
multiline.key_content log
multiline.parser multiline
[OUTPUT]
Name stdout
Match *
docker run -it --rm \
-v `pwd`/fluent-bit.conf:/fluent-bit/etc/fluent-bit.conf \
-v `pwd`/parsers.conf:/fluent-bit/etc/parsers.conf \
-v `pwd`/test.log:/test.log fluent/fluent-bit:1.8
[PARSER]
Name docker
Format json
Time_Key time
Time_Format %Y-%m-%dT%H:%M:%S.%LZ
[MULTILINE_PARSER]
Name multiline
Type regex
flush_timeout 1000
rule "start_state" "/^[^\s]/" "cont"
rule "cont" "/^\s+/" "cont"
{"log":"INFO [2021-11-10 20:00:28.717 +0000] (8 on call-home-server-int-758dc96f47-kgzxp): Mapped {/api/configuration/phoneHome, POST} route\n","stream":"stdout","time":"2021-11-10T20:00:28.719743819Z"}
{"log":" context: \"RouterExplorer\"\n","stream":"stdout","time":"2021-11-10T20:00:28.719747805Z"}
{"log":"INFO [2021-11-10 20:00:28.717 +0000] (8 on call-home-server-int-758dc96f47-kgzxp): Nest application successfully started\n","stream":"stdout","time":"2021-11-10T20:00:28.719772848Z"}
{"log":" context: \"NestApplication\"\n","stream":"stdout","time":"2021-11-10T20:00:28.719777187Z"}
{"log":"ERROR [2021-11-10 20:06:51.227 +0000] (8 on call-home-server-int-758dc96f47-kgzxp): Unhandled Error occurred\n","stream":"stdout","time":"2021-11-10T20:06:51.22965894Z"}
{"log":" context: \"ErrorFilter\"\n","stream":"stdout","time":"2021-11-10T20:06:51.22968884Z"}
{"log":" req: {\n","stream":"stdout","time":"2021-11-10T20:06:51.229692196Z"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment