logspout icon indicating copy to clipboard operation
logspout copied to clipboard

documentation update for swarm

Open sandys opened this issue 5 years ago • 1 comments

the docker template tags for swarm and compose are fairly different. it took my quite a while to figure out.

the source documentation is here - https://docs.docker.com/engine/reference/commandline/service_create/#create-services-using-templates

a working, reasonable logspout configuration for swarm is

  logspout:
    image: gliderlabs/logspout:latest
    networks:
      - logging
    volumes:
      - /etc/hostname:/etc/host_hostname:ro
      - /var/run/docker.sock:/var/run/docker.sock
    environment:
      - SYSLOG_TAG="{{index .Service.Name}}"
      - SYSLOG_HOSTNAME="{{index .Node.Hostname}}"
      - INACTIVITY_TIMEOUT=1m
      - BACKLOG=false
      - SYSLOG_STRUCTURED_DATA="logdna@48950 key=\"12345\" tag=\"swarm,stacks\""
      - LOGSPOUT=ignore
    command:
      multiline+syslog+tls://syslog-a.logdna.com:44533
    deploy:
      mode: global
      resources:
        limits:
          cpus: '0.20'
          memory: 50M
        reservations:
          cpus: '0.10'
          memory: 50M```

sandys avatar Jul 18 '19 10:07 sandys

I have a problem using this config, {{index .Service.Name}} resolves to the logspout service name, I want to tag every log entry with the service name of the container that created the log. Any advise?

niklas-dahl avatar Oct 12 '20 12:10 niklas-dahl