Reputation: 1754
I set up the docker run command in the unit file like:
docker run ... \
--log-driver=json-file \
--log-opt max-size=10m \
--log-opt max-file=10 \
...
.. which works so far (docker logs command works, log file is there, docker inspect shows given config).
BUT the container still writes to /var/log/syslog (which I want to disable). How do I disable this behavior?
Docker version: 1.10.3
Ubuntu: 15.04
(yeah, I know - the versions are not in my hand for now. Update is scheduled though)
Upvotes: 1
Views: 1724
Reputation: 1754
For reference:
It was the journald-config, not Docker itself that wrote the messages to the syslog.
To resolve this I simply set
MaxLevelSyslog=err
in /etc/systemd/journald.conf, which restricts the messages written into the syslog to errors and below (crit, alert, emerg)
Upvotes: 2
Reputation: 263469
If the container inspect shows the json logging driver is being used, and you see your logs appearing in /var/lib/docker/containers/*/*-json.log
, then docker is using the json log driver as expected.
You may have something else forwarding your docker logs to syslog. A tool like logspout could be used to do this forwarding. If that tool is running in a container itself, then you'd see it mount /var/lib/docker/containers as a volume.
Another possibility is that you have multiple containers running, one writing to syslog, and the other to json.
Either way, from the details provided, you have setup docker correctly and the issue is external to the above configuration.
Upvotes: 1