Reputation: 10347
I do have a docker.conf drop in on Ubuntu 16.04 for system.d that looks like this:
[Service]
ExecStart=
ExecStart=/usr/bin/docker daemon -H tcp://127.0.0.1:2376 --log-driver syslog --log-opt tag='docker/{{.Name}}'
I expected the tag in var/log/syslog to look like docker/ but it still is using {{.Name}}/{{.ID}}
Is there anything else I have to change?
Upvotes: 1
Views: 698
Reputation: 1305
It's not exactly clear from the documentation, but log tag configuration for a container is generated when the container is built.
If you rebuild your container(s), then you should see logging tagged with the new tags.
This was the case for me with Docker version 17.05.0-ce, build 89658be
.
The clue leading me to this discovery was from https://docs.docker.com/engine/admin/logging/log_tags/:
If you use docker rename to rename a container, the new name is not reflected in the log messages. Instead, these messages continue to use the original container name.
However, if you're using docker-compose, then setting the tags option under logging options takes effect when the container is restarted:
E.g.
services:
nginx:
logging:
options:
tag: "docker/{{.Name}}"
Upvotes: 2