Bug Report
Describe the bug
From time to time, the fluent-bit application hangs and stops collecting logs. No activity is performed, there are no logs from fluent-bit itself, and metrics stop being generated. The Kubernetes pod does not crash or restart when this issue occurs, and it remains in the Ready state. This problem can only be detected manually by noticing that the application's logs have not been delivered.
To Reproduce
- Deploy helm chart to Kubernetes cluster
- Start collecting logs from application in cluster
- Wait for a problem
Expected behavior
Stable operation and collection of all logs without hangs.
Your Environment
- Version used: chart version 0.47.9, app version 3.1.7
- Configuration:
[SERVICE]
Daemon Off
Flush {{ .Values.flush }}
Log_Level {{ .Values.logLevel }}
Parsers_File /fluent-bit/etc/parsers.conf
Parsers_File /fluent-bit/etc/conf/custom_parsers.conf
HTTP_Server On
HTTP_Listen 0.0.0.0
HTTP_Port {{ .Values.metricsPort }}
Health_Check On
storage.sync normal
storage.checksum off
storage.path /var/log/flb-storage/
[INPUT]
Name systemd
Tag host.*
Read_From_Tail On
storage.type filesystem
[INPUT]
Name tail
Tag kube.*
Path /var/log/containers/*.log
Parser cri
Skip_Long_Lines On
storage.type filesystem
[INPUT]
Name tail
Tag audit.*
Path /var/log/kube-audit/kube-audit.log
storage.type filesystem
[FILTER]
Name modify
Match host.*
Rename _HOSTNAME @HOSTNAME
Rename _MACHINE_ID @MACHINE_ID
Rename _BOOT_ID @BOOT_ID
Rename _CMDLINE @CMDLINE
Rename _COMM @COMM
Rename _EXE @EXE
Rename _PID @PID
Rename _UID @UID
Rename _GID @GID
Rename _CAP_EFFECTIVE @CAP_EFFECTIVE
Rename _SELINUX_CONTEXT @SELINUX_CONTEXT
Rename _AUDIT_LOGINUID @AUDIT_LOGINUID
Rename _AUDIT_SESSION @AUDIT_SESSION
Rename _SYSTEMD_CGROUP @SYSTEMD_CGROUP
Rename _SYSTEMD_SLICE @SYSTEMD_SLICE
Rename _SYSTEMD_UNIT @SYSTEMD_UNIT
Rename _SYSTEMD_SESSION @SYSTEMD_SESSION
Rename _SYSTEMD_OWNER_UID @SYSTEMD_OWNER_UID
Rename _TRANSPORT @TRANSPORT
Rename _KERNEL_DEVICE @KERNEL_DEVICE
Rename _KERNEL_SUBSYSTEM @KERNEL_SUBSYSTEM
Rename _UDEV_SYSNAME @UDEV_SYSNAME
Rename _UDEV_DEVNODE @UDEV_DEVNODE
Rename _UDEV_DEVLINK @UDEV_DEVLINK
Remove _SOURCE_REALTIME_TIMESTAMP
[FILTER]
Name parser
Match kube.*
Key_Name message
Parser json_custom
Reserve_Data True
[FILTER]
Name kubernetes
Match kube.*
Merge_Log On
Keep_Log Off
K8S-Logging.Parser On
K8S-Logging.Exclude On
[FILTER]
Name lua
Match kube.*
script /fluent-bit/scripts/filters.lua
Call modify_log
[FILTER]
Name rewrite_tag
Match kube.*
Rule $es_index_date ^(daily)$ daily.$TAG false
[FILTER]
Name rewrite_tag
Match kube.*
Rule $es_index_date ^(weekly)$ weekly.$TAG false
[FILTER]
Name rewrite_tag
Match kube.*
Rule $es_index_date ^(monthly)$ monthly.$TAG false
[FILTER]
Name record_modifier
Match audit.*
Record cluster <cluster-name>
[OUTPUT]
Name es
Match host.*
Host ${ELASTICSEARCH_HOST}
Port ${ELASTICSEARCH_PORT}
HTTP_User ${ELASTICSEARCH_USER}
HTTP_Passwd ${ELASTICSEARCH_PASSWORD}
Logstash_Format On
Logstash_Prefix infra=journal
Logstash_DateFormat %Y-%m-%d
Time_Key @SOURCE_REALTIME_TIMESTAMP
Time_Key_Format %Y-%m-%dT%H:%M:%S
storage.total_limit_size 1G
[OUTPUT]
Name es
Match daily.kube.*
Host ${ELASTICSEARCH_HOST}
Port ${ELASTICSEARCH_PORT}
HTTP_User ${ELASTICSEARCH_USER}
HTTP_Passwd ${ELASTICSEARCH_PASSWORD}
Logstash_Format On
Logstash_Prefix_Key pre_index
Logstash_DateFormat %Y-%m-%d
Time_Key_Nanos On
storage.total_limit_size 1G
[OUTPUT]
Name es
Match weekly.kube.*
Host ${ELASTICSEARCH_HOST}
Port ${ELASTICSEARCH_PORT}
HTTP_User ${ELASTICSEARCH_USER}
HTTP_Passwd ${ELASTICSEARCH_PASSWORD}
Logstash_Format On
Logstash_Prefix_Key pre_index
Logstash_DateFormat %Y-w%W
Time_Key_Nanos On
storage.total_limit_size 1G
[OUTPUT]
Name es
Match monthly.kube.*
Host ${ELASTICSEARCH_HOST}
Port ${ELASTICSEARCH_PORT}
HTTP_User ${ELASTICSEARCH_USER}
HTTP_Passwd ${ELASTICSEARCH_PASSWORD}
Logstash_Format On
Logstash_Prefix_Key pre_index
Logstash_DateFormat %Y-m%m
Time_Key_Nanos On
storage.total_limit_size 1G
[OUTPUT]
name syslog
match audit.*
host <private-host>
port 15110
mode udp
syslog_format rfc3164
syslog_maxsize 2048
syslog_hostname_key cluster
syslog_message_key log
storage.total_limit_size 4G
[PARSER]
Name json_custom
Format json
filters.lua: |
function modify_log(tag, timestamp, record)
-- Add cluster name.
record.kubernetes.cluster = "{{ .Environment.Name }}"
-- Check that annotations exist.
if record["kubernetes"]["annotations"] then
-- Check that es-index-project annotation exists.
if record["kubernetes"]["annotations"]["example.com/es-index-project"] then
-- Check that es-index-project annotation contains a value
if string.len(record["kubernetes"]["annotations"]["example.com/es-index-project"]) > 0 then
es_index_project = record["kubernetes"]["annotations"]["example.com/es-index-project"]
else
-- If there is no value, then you need to assign fixme so as not to lose logs
es_index_project = "fixme"
end
-- Check that es-index-date annotation exists.
if record["kubernetes"]["annotations"]["example.com/es-index-date"] then
es_index_date = record["kubernetes"]["annotations"]["example.com/es-index-date"]
if es_index_date == "daily" then
record.es_index_date = es_index_date
elseif es_index_date == "weekly" then
record.es_index_date = es_index_date
elseif es_index_date == "monthly" then
record.es_index_date = es_index_date
else
-- Discard the log if es-index-date is not equal daily|weekly|monthly.
return -1, 0, 0
end
-- Check that es-index-ext annotation exists.
if record["kubernetes"]["annotations"]["example.com/es-index-ext"] then
es_index_ext = record["kubernetes"]["annotations"]["example.com/es-index-ext"]
-- Check that es-index-ext is not nil.
if string.len(es_index_ext) > 0 then
-- Create a prefix with es_index_ext key for the index.
record.pre_index = es_index_project .. "=k8s-" .. es_index_ext
end
else
-- Create a prefix without es_index_ext key for the index.
record.pre_index = es_index_project .. "=k8s"
end
else
-- Discard the log if es-index-date is not exists.
return -1, 0, 0
end
else
-- Discard the log if es-index-project is not exists.
return -1, 0, 0
end
else
-- Discard the log if es-index-project is not exists.
return -1, 0, 0
end
-- Return the modified log.
return 2, timestamp, record
end
- Environment name and version (e.g. Kubernetes? What version?): vanilla kubernetes v1.30.6
- Server type and version: VM on libvirt
- Operating System and version: CentOS 9 Stream 6.10.10-1.el9.elrepo.x86_64
- Filters and plugins: In config.
Additional context
The issue does not occur frequently. It happens a few times per week on one of over 400 instances. It might occur more often, but we do not notice it due to the difficulty of detecting the problem.
Bug Report
Describe the bug
From time to time, the fluent-bit application hangs and stops collecting logs. No activity is performed, there are no logs from fluent-bit itself, and metrics stop being generated. The Kubernetes pod does not crash or restart when this issue occurs, and it remains in the
Readystate. This problem can only be detected manually by noticing that the application's logs have not been delivered.To Reproduce
Expected behavior
Stable operation and collection of all logs without hangs.
Your Environment
Additional context
The issue does not occur frequently. It happens a few times per week on one of over 400 instances. It might occur more often, but we do not notice it due to the difficulty of detecting the problem.