Score:0

How do I get Docker to include the host hostname in syslog?

um flag
Tim

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?

pt flag
"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.
Score:0
um flag
Tim

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.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.