Hello,
Our filebeat (9.0.3) is configured on kubernetes cluster as daemonset to collect logs from applications and to send it to logstash and we have a following configuration:
filebeat.config:
modules:
path: ${path.config}/modules.d/*.yml
# Reload module configs as they change:
reload.enabled: false
filebeat.inputs:
- type: filestream
id: "filebeat-${NODE_NAME}"
prospector.scanner.symlinks: true
close.on_state_change.inactive: 10m
format: cri
paths:
- /var/log/containers/*.log
enabled: true
parsers:
- container: ~
fields:
logstashSource: "filebeat-k8s--console-json"
processors:
- add_kubernetes_metadata:
host: ${NODE_NAME}
in_cluster: true
default_matchers.enabled: false
matchers:
- logs_path:
logs_path: /var/log/containers/
- drop_event:
when:
not.equals.kubernetes.labels.logging-type: "console-json"
- decode_json_fields:
fields: ["message"]
process_array: true
max_depth: 1
target: "logData"
- rename:
when:
not.has_fields: ['logData.appName']
fields:
- from: "kubernetes.labels.app"
to: "logData.appName"
- rename:
when:
not.has_fields: ['logData.message']
fields:
- from: "message"
to: "logData.message"
- rename:
fields:
- from: "kubernetes.node.name"
to: "logData.node"
- rename:
fields:
- from: "fields.logstashSource"
to: "logData.logstashSource"
- drop_fields:
fields: ["stream", "message", "prospector", "offset", "input", "source", "kubernetes", "fields", "log"]
At the beginning everything works as expected and filebeat is collecting all logs (application produces small, single logs). If there is a longer break and last log occurance is greater than 10 minutes (which is close.on_state_change.inactive) we notice a strange behaviour. It looks like filebeat is not processing first few logs. After that next logs are processed correctly. Unfortunatelly those first few logs are missing and never published to Logstash and OpenSearch. I looked at filebeat registry and offset is updated and bigger then before break. Do you have any idea what can be a reason?
Example:
10:00:00 log occures
10:11:00 new log(s) occures (however never published to Logstash)
10:11:15 all next logs are published to Logstash