fluent-plugins-nursery / fluent-plugin-systemd

This is a fluentd input plugin. It reads logs from the systemd journal.
Apache License 2.0
153 stars 43 forks source link

Heavy/Rapid fluentd container logs are logged while the docker daemon logging driver is set to journald when used fluentd-plugin-systemd #64

Closed ameyrk18 closed 6 years ago

ameyrk18 commented 6 years ago

Hi There,

Looks like the fluent-plugin-systemd logs rapid and huge container logs of fluentd when the logging driver of docker daemon is set to journald. Below is the example and also you see thousands of backslash charaters. My log files have grown in GB now. Things get back to normal when I set the docker logging driver to json. Is this expected behaviour?

May 16 11:01:09 ip-172-25-0-204 debfd82b3369: 2018-05-16 11:01:08.389579000 +0000 kube-proxy: {"priority":"6","container_name":"fluentd","container_partial_message":"true","transport":"journal","pid":"1 432","uid":"0","gid":"0","comm":"dockerd","exe":"/usr/bin/dockerd","cmdline":"/usr/bin/dockerd","cap_effective":"1fffffffff","systemd_cgroup":"/system.slice/docker.service","systemd_unit":"docker.servic e","systemd_slice":"system.slice","selinux_context":"system_u:system_r:container_runtime_t:s0","boot_id":"bd7c6704228948fc9a8a7ee6f8795586","machine_id":"f073c429a7456b53ec3e2c53460c5c8f","hostname":"ip -172-25-0-204","container_tag":"debfd82b3369","syslog_identifier":"debfd82b3369","container_id":"debfd82b3369","container_id_full":"debfd82b33696a2c9162d6afa6e6e2e5ebcdf104fa985f6e2430e8e82782c57e","mes sage":"2018-05-16 11:01:07.925657000 +0000 kube-proxy: {\"priority\":\"6\",\"container_name\":\"fluentd\",\"transport\":\"journal\",\"pid\":\"1432\",\"uid\":\"0\",\"gid\":\"0\",\"comm\":\"dockerd\",\"ex e\":\"/usr/bin/dockerd\",\"cmdline\":\"/usr/bin/dockerd\",\"cap_effective\":\"1fffffffff\",\"systemd_cgroup\":\"/system.slice/docker.service\",\"systemd_unit\":\"docker.service\",\"systemd_slice\":\"sys tem.slice\",\"selinux_context\":\"system_u:system_r:container_runtime_t:s0\",\"boot_id\":\"bd7c6704228948fc9a8a7ee6f8795586\",\"machine_id\":\"f073c429a7456b53ec3e2c53460c5c8f\",\"hostname\":\"ip-172-25 -0-204\",\"container_tag\":\"debfd82b3369\",\"syslog_identifier\":\"debfd82b3369\",\"container_id\":\"debfd82b3369\",\"container_id_full\":\"debfd82b33696a2c9162d6afa6e6e2e5ebcdf104fa985f6e2430e8e82782c 57e\",\"message\":\"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\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\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

Thanks, Amey

Jitsusama commented 6 years ago

Hello @ameyrk18; I've run into this problem myself. This is generally caused when fluentd is configured to write out log events to STDOUT, when configured to use systemd as the log-driver, when fluentd is configured to process logs from systemd.

You've basically created a loop, where one container sends a log to STDERR/STDOUT, Docker forwards this to systemd, systemd forwards this to fluentd, fluentd forwards this to STDOUT, which forwards to systemd, which forwards to fluentd, which...

The way I've gotten around this is by configuring the fluentd Docker container to use json-file as its log-driver. When you configure the log-driver in /etc/docker/daemon.json, that sets the default log-driver, but you can still over-ride this on container creation with the --log-driver json-file option being passed to docker container run.

ameyrk18 commented 6 years ago

Hi @Jitsusama yes your right that happens when the output driver is set stdout. Ahh, yes now I get the loops :) weird. Not sure if this is expected or not.

I bypassed this as you said. Reconfigured my docker logging to journald and forced the container (fluentd) to use json logging.

Many thanks for your inputs.

I leave this topic with the owner to close this if this is not an issue.

Thanks, Amey

errm commented 6 years ago

Thanks for raising this @ameyrk18

I guess we should document that this can happen ...

Am I correct in thinking @ameyrk18 that when this issue occurs you are reading the full journal without setting matches/filters?

ameyrk18 commented 6 years ago

@errm . I will document this and update READ.me

Yes your understanding is correct I am reading full journal without setting matches/filters.

Best Regards, Amey