Closed
Description
Bug Report
Describe the bug
Output plugin "loki" will cause Fluent Bit 1.6.1 abort due to segfault if there is no "label_keys" in loki output config section
To Reproduce
Use this config file and start fluent bit
[SERVICE]
flush 1
log_level debug
[INPUT]
name dummy
dummy {"key": 1, "sub": {"stream": "stdout", "id": "some id"}, "kubernetes": {"labels": {"team": "Santiago Wanderers"}}}
samples 1
mem_buf_limit 1M
[OUTPUT]
name loki
match *
host 172.18.0.17
port 8081
tenant_id loki-test
labels job=fluentbit
Here is Fluent Bit logs
Fluent Bit v1.6.1
* Copyright (C) 2019-2020 The Fluent Bit Authors
* Copyright (C) 2015-2018 Treasure Data
* Fluent Bit is a CNCF sub-project under the umbrella of Fluentd
* https://fluentbit.io
[2020/10/18 02:46:40] [ info] Configuration:
[2020/10/18 02:46:40] [ info] flush time | 1.000000 seconds
[2020/10/18 02:46:40] [ info] grace | 5 seconds
[2020/10/18 02:46:40] [ info] daemon | 0
[2020/10/18 02:46:40] [ info] ___________
[2020/10/18 02:46:40] [ info] inputs:
[2020/10/18 02:46:40] [ info] dummy
[2020/10/18 02:46:40] [ info] ___________
[2020/10/18 02:46:40] [ info] filters:
[2020/10/18 02:46:40] [ info] ___________
[2020/10/18 02:46:40] [ info] outputs:
[2020/10/18 02:46:40] [ info] loki.0
[2020/10/18 02:46:40] [ info] ___________
[2020/10/18 02:46:40] [ info] collectors:
[2020/10/18 02:46:40] [ info] [engine] started (pid=42959)
[2020/10/18 02:46:40] [debug] [engine] coroutine stack size: 24576 bytes (24.0K)
[2020/10/18 02:46:40] [debug] [storage] [cio stream] new stream registered: dummy.0
[2020/10/18 02:46:40] [ info] [storage] version=1.0.6, initializing...
[2020/10/18 02:46:40] [ info] [storage] in-memory
[2020/10/18 02:46:40] [ info] [storage] normal synchronization mode, checksum disabled, max_chunks_up=128
[2020/10/18 02:46:40] [engine] caught signal (SIGSEGV)
#0 0x4beea5 in ???() at ???:0
#1 0x4bf1bd in ???() at ???:0
#2 0x4bf3ce in ???() at ???:0
#3 0x444e97 in ???() at ???:0
#4 0x44ef8c in ???() at ???:0
#5 0x43c36e in ???() at ???:0
#6 0x7fbda587e6b9 in ???() at ???:0
#7 0x7fbda4e9141c in ???() at ???:0
#8 0xffffffffffffffff in ???() at ???:0
Aborted
But Fluent Bit will works if there is "label_keys" like below
[SERVICE]
flush 1
log_level debug
[INPUT]
name dummy
dummy {"key": 1, "sub": {"stream": "stdout", "id": "some id"}, "kubernetes": {"labels": {"team": "Santiago Wanderers"}}}
samples 1
mem_buf_limit 1M
[OUTPUT]
name loki
match *
host 172.18.0.17
port 8081
tenant_id loki-test
labels job=fluentbit
label_keys $sub['stream']
Logs
Fluent Bit v1.6.1
* Copyright (C) 2019-2020 The Fluent Bit Authors
* Copyright (C) 2015-2018 Treasure Data
* Fluent Bit is a CNCF sub-project under the umbrella of Fluentd
* https://fluentbit.io
[2020/10/18 03:04:08] [ info] Configuration:
[2020/10/18 03:04:08] [ info] flush time | 1.000000 seconds
[2020/10/18 03:04:08] [ info] grace | 5 seconds
[2020/10/18 03:04:08] [ info] daemon | 0
[2020/10/18 03:04:08] [ info] ___________
[2020/10/18 03:04:08] [ info] inputs:
[2020/10/18 03:04:08] [ info] dummy
[2020/10/18 03:04:08] [ info] ___________
[2020/10/18 03:04:08] [ info] filters:
[2020/10/18 03:04:08] [ info] ___________
[2020/10/18 03:04:08] [ info] outputs:
[2020/10/18 03:04:08] [ info] loki.0
[2020/10/18 03:04:08] [ info] ___________
[2020/10/18 03:04:08] [ info] collectors:
[2020/10/18 03:04:08] [ info] [engine] started (pid=42972)
[2020/10/18 03:04:08] [debug] [engine] coroutine stack size: 24576 bytes (24.0K)
[2020/10/18 03:04:08] [debug] [storage] [cio stream] new stream registered: dummy.0
[2020/10/18 03:04:08] [ info] [storage] version=1.0.6, initializing...
[2020/10/18 03:04:08] [ info] [storage] in-memory
[2020/10/18 03:04:08] [ info] [storage] normal synchronization mode, checksum disabled, max_chunks_up=128
[2020/10/18 03:04:08] [ info] [output:loki:loki.0] configured, hostname=172.18.0.17:8081
[2020/10/18 03:04:08] [debug] [router] match rule dummy.0:loki.0
[2020/10/18 03:04:08] [ info] [sp] stream processor started
[2020/10/18 03:04:09] [debug] [task] created task=0x7f2868005b80 id=0 OK
[2020/10/18 03:04:09] [ info] [output:loki:loki.0] 172.18.0.17:8081, HTTP status=204
[2020/10/18 03:04:09] [debug] [upstream] KA connection #24 to 172.18.0.17:8081 is now available
[2020/10/18 03:04:09] [debug] [task] destroy task=0x7f2868005b80 (task_id=0)
Expected behavior
Fluent Bit works event there if no "label_keys" in loki output plugin config section
Your Environment
docker container of Ubuntu16.04