I want to aggregate container logs with fluentd running in a container. To use the fluentd log driver automatically I start de docker daemon with the option
--log-driver=fluentd
Which works fine.
The problem is: I don’t have all the logs. I am missing the logs from before fluentd has initialized. After that everything is logged through fluentd. Which was surprising to me, since in the documentation it states that de default maximum size of the log buffer is 8M, so I assumed the docker daemon would buffer all output until it could connect to fluent.
I then tried to start the docker daemon with the following options:
# docker daemon --log-driver=fluentd INFO[0000] [graphdriver] using prior storage driver "aufs" INFO[0000] Graph migration to content-addressability took 0.00 seconds INFO[0000] Firewalld running: false INFO[0000] Default bridge (docker0) is assigned with an IP address 172.17.0.0/16. Daemon option --bip can be used to set a preferred IP address INFO[0000] Loading containers: start. INFO[0000] Loading containers: done. INFO[0000] Daemon has completed initialization INFO[0000] Docker daemon INFO[0000] API listen on /var/run/docker.sock
# docker daemon --log-driver=fluentd --log-opt fluent-async-connect=true FATA[0000] Failed to set log opts: unknown log opt 'fluent-async-connect' for fluentd log driver
Hmmm. Stumbled upon the changelog for docker 1.11:
Logging
…
The fluentd log driver learned the following options: fluentd-address, fluentd-buffer-limit, fluentd-retry-wait, fluentd-max-retries and fluentd-async-connect (#19439)
# docker daemon --log-driver=fluentd --log-opt fluentd-async-connect=true INFO[0000] New containerd process, pid: 6988 WARN[0000] containerd: low RLIMIT_NOFILE changing to max current=1024 max=4096 INFO[0001] [graphdriver] using prior storage driver "aufs" INFO[0001] Graph migration to content-addressability took 0.01 seconds INFO[0001] Firewalld running: false INFO[0001] Default bridge (docker0) is assigned with an IP address 172.17.0.0/16. Daemon option --bip can be used to set a preferred IP address WARN[0001] mountpoint for pids not found INFO[0001] Loading containers: start. INFO[0001] Loading containers: done. INFO[0001] Daemon has completed initialization INFO[0001] Docker daemon commit=4dc5990 graphdriver=aufs version=1.11.0 INFO[0001] API listen on /var/run/docker.sock