0

I have configured docker to use the syslog log driver. My daemon.json looks like this:

{
  "log-driver": "syslog",
  "log-opts": {
    "syslog-address": "tcp://192.168.1.10:1514",
    "mode": "non-blocking",
    "tag": "{{.ImageName}}/{{.Name}}"
  }
}

According to docker docs on the tag parameter, this should produce an output that includes the hostname of the host device. This does not happen - my logs look like this (truncated):

<27>Dec 22 19:27:44 authelia/authelia/authelia[3693936]: time="2022-12-22T19:27:44-05:00" level=info msg="...

I could just write the hostname into the tag parameter, but I'd like to use this config on many machines. Am I missing something?

Tim
  • 9
  • 1
  • "According to docker docs on the tag parameter, this should produce an output that includes the hostname of the host device" I just read through the docs to which you've linked, and nothing there suggests that to be the case. Your best bet is probably configuring your log server at `tcp://192.168.1.10:1514` to include the originating hostname in logged messages. – larsks Dec 23 '22 at 01:14

1 Answers1

0

I figured out the issue. The solution was (as usual) reading more docs.

https://docs.docker.com/config/containers/logging/syslog/#options

syslog-format The syslog message format to use. If not specified the local UNIX syslog format is used, without a specified hostname. Specify rfc3164 for the RFC-3164 compatible format, rfc5424 for RFC-5424 compatible format, or rfc5424micro for RFC-5424 compatible format with microsecond timestamp resolution.

If you do not specify a format it will omit the hostname.

Tim
  • 9
  • 1