logspout icon indicating copy to clipboard operation
logspout copied to clipboard

Hostname using raw adapter

Open radeth opened this issue 4 years ago • 0 comments

Hi I'm trying to send logs on remote machine using raw adapter. On my log machine im using ELK (logstash). I have received container name in go template but i cant recevice properly hostname. A "host" field is ip number instead of hostname. I tried receive hostname in go-template with i used in raw_format variable like this:

  • "RAW_FORMAT={ "container": {{ toJSON .Container.Name }},"message": {{ toJSON .Data }},"hostname": {{ toJSON .Container.Config.Hostname }} }\n" but i receive "localhost"

here is my docker-compose.yaml file version: "3" networks: logging: services: logspout: image: gliderlabs/logspout:v3.2.12 command: 'raw+tcp://some.addres:5000' environment: - DEBUG=1 - "RAW_FORMAT={ "container": {{ toJSON .Container.Name }},"message": {{ toJSON .Data }},"hostname": {{ toJSON .Container.Config.Hostname }} }\n" volumes: - /etc/hostname:/etc/hostname - /etc/hosts:/etc/hosts - /var/run/docker.sock:/var/run/docker.sock networks: - logging

radeth avatar May 12 '21 11:05 radeth