Skip to main content
Skip table of contents

Enable Syslog Logging on Docker Containers

This optional functionality enables users to send docker logs to the console in the syslog format. When using this functionality, the only major change is that containers will not be able to write the logs to volume, though they can export logs as they were previously.

Enable the Syslog Driver

All docker container logs of an Open Collector deployment can be sent to a syslog server using a syslog logging driver. To use the syslog driver as the default logging driver, perform the following steps:

  1. Set the log-driver and log-opt keys to appropriate values in the daemon.json file, which is located at /etc/docker/ on Linux hosts.

    If the daemon.json file does not exist yet, it can be created.

    The following example sets the log driver to syslog and sets the syslog-address option. The syslog-address options support both UDP and TCP; this example uses TCP.

    CODE
    {
      "log-driver": "syslog",
      "log-opts": {
        "syslog-address": "tcp://1.2.3.4:1111"
      }
    }
  2. Restart Docker for the changes to take effect using the following commands:

    CODE
    $ sudo systemctl daemon-reload
    $ sudo systemctl restart docker
  3. Restart each running container after that:

    CODE
    $ ./lrctl oc restart
    $ ./lrctl metrics restart
    $ ./lrctl ehb restart 

    This example does not necessarily represent all running containers.

  4. Verify that the docker logs are now flowing to the syslog server:

Revert to JSON Logging

In the event that you wish to switch back to JSON logging from syslog logging, perform the following steps:

  1. Remove the daemon.json file:

    CODE
    $ rm /etc/docker/daemon.json
  2. Restart the Docker for the changes to take effect using the following commands:

    CODE
    $ sudo systemctl daemon-reload
    $ sudo systemctl restart docker
  3. Restart each running container after that:

    CODE
    $ ./lrctl oc restart
    $ ./lrctl metrics restart
    $ ./lrctl ehb restart 

    This example does not necessarily represent all running containers.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.