Skip to content

Hostname using raw adapter  #507

@radeth

Description

@radeth

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions