2

I'm trying to implement centralised logging for a number of micro-service docker containers.

To achieve this I'm attempting to use the recommended syslog logging driver approach, to deliver logs to loggly.

https://www.loggly.com/docs/docker-logging-driver/

I've done the following...

On the remote docker-machine...

$ curl -O https://www.loggly.com/install/configure-linux.sh
$ sudo bash configure-linux.sh -a SUBDOMAIN -u USERNAME

It verified that everything worked correctly, and I can see that the host events are now going through to the loggly console.

I then configured the services in docker-compose, like so...

  nginx_proxy:
    build: nginx_proxy
    logging:
      driver: "syslog"
      options:
        tag: "{{.ImageName}}/{{.Name}}/{{.ID}}"

I then rebuilt and re-launched the containers, with...

$ docker-compose up --build -d

However I'm not getting any logs from the containers going to loggly.

I can verify that the syslog driver update has taken effect by doing...

$ docker-compose logs nginx_proxy

This reports...

nginx_proxy_1             | WARNING: no logs are available with the 'syslog' log driver

Which is what I would expect to see, as this log driver doesn't work for viewing logs locally.

Is there something else I need to do to get this working correctly?

user1751825
  • 4,029
  • 1
  • 28
  • 58
  • 1
    were you able to get syslog working correctly with docker-compose? – dylanjha Nov 22 '18 at 01:39
  • @dylanjha I got it working, but ended up turning it off again, because of the multi-line log entry issue. I couldn't figure out a way to get it to keep multi-line log entries together, which made the logs not very useful. – user1751825 Nov 22 '18 at 01:43
  • Thank you for the quick reply :) I wasn't able to get syslog working with docker-compose, posted here https://stackoverflow.com/questions/53422818/docker-compose-logging-is-not-working-with-syslog-option – dylanjha Nov 22 '18 at 01:48

1 Answers1

0

Can you share Dockerfile in nginx_proxy directory? Did you confirm that it is generating logs?

To test, can you swap out nginx with basic ubuntu that echo's something like they show in loggly documentation: https://www.loggly.com/docs/docker-logging-driver/

Run:

sudo docker run -d --log-driver=syslog --log-opt tag="{{.ImageName}}\{{.Name}}\{{.ID}}" ubuntu echo "Test Log"

Check:

$ tail /var/log/syslog
Phani Kandula
  • 387
  • 2
  • 3
  • Thanks. This helped me track down my main issue, of getting the logs to loggly. Do you by any chance know how to get it to keep multi-line entries together? I've posted another question https://stackoverflow.com/questions/52324118/docker-compose-syslog-driver-loggly-multi-line-log-entries – user1751825 Sep 14 '18 at 02:21