The upstream logspout project supports reading /etc/host_hostname to determine the hostname. This allows one to expose the actual hosts name to the container rather than using the container id.
Currently, this does not work for logdna's logspout as the HOSTNAME environment variable appears to be the only way to set the hostname.
I am currently working around this as follows:
docker run -d \
-v /var/run/docker.sock:/var/run/docker.sock \
-v /etc/hostname:/etc/host_hostname:ro \
-e LOGDNA_KEY=<key> \
--entrypoint /bin/sh \
logdna/logspout:latest \
-c "HOSTNAME=\`cat /etc/host_hostname\` /bin/logspout"
I'm starting this container as part of an image baking process, so I cannot set the hostname to the value at the time the container is created as it will change.
The upstream logspout project supports reading
/etc/host_hostnameto determine the hostname. This allows one to expose the actual hosts name to the container rather than using the container id.Currently, this does not work for logdna's logspout as the
HOSTNAMEenvironment variable appears to be the only way to set the hostname.I am currently working around this as follows:
I'm starting this container as part of an image baking process, so I cannot set the hostname to the value at the time the container is created as it will change.