Docker/hostname question
Closed this issue · 1 comments
cookandy commented
Hello,
I was wondering how the docker/hostname
field is calculated. It seems like on some of my running containers I get the real hostname (the hostname of the machine the container started on). But other times I get the hostname of the docker container itself. Here are two examples:
With internal docker hostname:
logstash-forwarder_1 | "fields": {
logstash-forwarder_1 | "codec": "json",
logstash-forwarder_1 | "docker/hostname": "3aebf47bfd1d",
logstash-forwarder_1 | "docker/id": "3aebf47bfd1dea7e76e7462fb0cbb31202c719ac9557f849b14616986e851073",
logstash-forwarder_1 | "docker/image": "hsip:latest",
logstash-forwarder_1 | "docker/name": "/mesos-9b712f4f-1427-4d72-a5cd-56aadbc257e0-S1.3b852b44-0625-4cd1-9a2b-82b977db9f1a",
logstash-forwarder_1 | "type": "docker"
logstash-forwarder_1 | }
logstash-forwarder_1 | },
With real hostname:
logstash-forwarder_1 | "fields": {
logstash-forwarder_1 | "codec": "json",
logstash-forwarder_1 | "docker/hostname": "centOS1",
logstash-forwarder_1 | "docker/id": "c9496b4947e86151e82425775248432cfd63b29a5031702063c655f6eead4446",
logstash-forwarder_1 | "docker/image": "paas-4-saas:latest",
logstash-forwarder_1 | "docker/label/com-docker-compose-config-hash": "7dcfe961eade91ed9c7bf190cc3b91fd3a80b6367de25ad8cfd2c5f679eb437b",
logstash-forwarder_1 | "docker/label/com-docker-compose-container-number": "1",
logstash-forwarder_1 | "docker/label/com-docker-compose-oneoff": "False",
logstash-forwarder_1 | "docker/label/com-docker-compose-project": "paas4saas",
logstash-forwarder_1 | "docker/label/com-docker-compose-service": "PaaS-4-SaaS",
logstash-forwarder_1 | "docker/label/com-docker-compose-version": "1.5.1",
logstash-forwarder_1 | "docker/name": "/paas4saas_PaaS-4-SaaS_1",
logstash-forwarder_1 | "type": "docker"
logstash-forwarder_1 | }
logstash-forwarder_1 | }
logstash-forwarder_1 | ]
logstash-forwarder_1 | }
digital-wonderland commented
It is whatever fsouza/go-dockerclient returns in the containers Config.Hostname
field.