Victor
Victor

Reputation: 2546

Logging with docker-compose: Can I use two drivers at the same time?

I´m using docker-compose 1.7.1 to launch a number of containers and gelf to send all the logs to an ELK installation.

It works fine, however, we are still learning how to use the whole set up and it would be very convenient to see the logs in the docker standard output (and therefore reachable by executing docker logs).

So, my question is: Is there a way to use two drivers at the same time?

I tried this, but the first driver is ignored:

logging:  
      driver: json
      driver: gelf
      options:
       gelf-address: "udp://${ELK_HOST_IP}:12201"

Are you aware of other way to see the logs in the standard output that might not involve the Docker compose logging driver?

Thanks!

Upvotes: 1

Views: 2089

Answers (1)

Matt
Matt

Reputation: 74879

To keep docker logs working you need to use the json-file or journald logging drivers.

Using the journald driver, you can then send your journal as an input for logstash or forward it via GELF.

With the default json-file driver you could process the log files directly. logstash has a generic json_lines input which would work but I'm not aware of something pre existing for docker, probably due to dockers support for the native inputs.

For any network logging, the events can usually be sent to a local forwarder which can both write to a local log file and forward onto your network server. This is a classic syslog setup. It's not docker logs, but close.

Upvotes: 1

Related Questions