Hi there!
I’ve been working on collecting docker-daemon-logs from an instance and I’ve been doing it using inputs.tail with a grok pattern that fits the ones from dockerd and containerd. I’ve been doing tests using /path/to/telegraf/executable --config /path/to/my/telegraf/configfile --once and occasionally, I’ve added the --debug flag. While I’ve used this and an output to a file it has been working well. but if I leave it to the usual configuration of Telegraf, no log is being sent to Graylog, its final destination. As i said before, if I execute telegraf with the --once option it works as expected and I can see the logs in Graylog.
These are my inputs conf:
[[inputs.tail]]
name_override = "userdata_logs"
files = ["/first/file.log"]
from_beginning = true
pipe = false
watch_method = "inotify"
character_encoding = "utf-8"
data_format = "grok"
grok_patterns = ["%{GREEDYDATA:message}"]
[inputs.tail.tags]
metric_type = "logs"
[[inputs.tail]]
name_override = "docker_daemon_journal"
files = ["/var/log/messages"]
from_beginning = true
pipe = false
watch_method = "inotify"
character_encoding = "utf-8"
data_format = "grok"
grok_patterns = ['%{SYSLOGTIMESTAMP:timestamp}\s*%{SYSLOGHOST:hostname}\s*%{WORD:process}\s*:\s*time="%{TIMESTAMP_ISO8601:log_timestamp}"\s*level=%{LOGLEVEL:log_level}\s*msg="%{GREEDYDATA:message}"']
[inputs.tail.tags]
metric_type = "logs"
All other inputs and outputs are working as expected except this two. These are the logs when using --once --debug
023-07-27T22:27:44Z D! [agent] Connecting outputs
2023-07-27T22:27:44Z D! [agent] Attempting connection to [outputs.influxdb_v2]
2023-07-27T22:27:44Z D! [agent] Successfully connected to outputs.influxdb_v2
2023-07-27T22:27:44Z D! [agent] Starting service inputs
2023-07-27T22:27:44Z E! [agent] Starting input inputs.syslog: listen udp :5514: bind: address already in use
2023-07-27T22:27:44Z D! [inputs.tail] Tail added for "/first/file.log"
2023-07-27T22:27:44Z D! [inputs.tail] Tail added for "/var/log/messages"
2023-07-27T22:27:44Z E! [agent] Starting input inputs.influxdb_v2_listener: listen tcp :8186: bind: address already in use
##########
Many lines of "Grok no match found for:" after
##########
2023-07-27T22:27:46Z D! [agent] Stopping service inputs
2023-07-27T22:27:46Z D! [inputs.tail] Tail removed for "/first/file.log"
2023-07-27T22:27:46Z D! [inputs.tail] Tail removed for "/var/log/messages"
2023-07-27T22:27:46Z D! [agent] Input channel closed
2023-07-27T22:27:47Z D! [agent] Processor channel closed
2023-07-27T22:27:48Z D! [agent] Processor channel closed
2023-07-27T22:27:48Z I! [agent] Hang on, flushing any cached metrics before shutdown
2023-07-27T22:27:48Z D! [outputs.influxdb_v2] Wrote batch of 939 metrics in 139.440173ms
2023-07-27T22:27:48Z D! [outputs.influxdb_v2] Buffer fullness: 0 / 10000 metrics
Could you help me with this?