Logging

Due to a limitation on the docker engines logging implementation, lcp-compose is required to jump through few hoops to make sure that log files are captured to file-system as well as shown on docker logs command output.

Details

If the default docker logging driver is switched from json-file to anything else other than journald, the docker logs command stops working. Since lcp-compose is meant to be a development tool, it is essential to have quick and reliable access to container's standard output. The straight forward solution to this problem would be to simply switch to the journald driver and use systemd to redirect logs to specific destinations. However, systemd is yet to see widespread adoption and making it a hard requirement would make lcp-compose inoperable in many systems (including TeamCity build agents).

Solution

Introduce logspout, a containerized program that is designed to solve this specific problem. Logspout maps the docker socket and uses the docker engine APIs to tail logs from each running container. These logs streams can then be directly forwarded to a syslog destination.

Architecture

+------------+
|   orders   |
+-----+------+                                       +-------------------+
      |                         +--------------------+  splunkforwarder  |
      |                         |                    +----------+--------+
+-----v------+                  v                               |
|  logspout  |           /path/to/log/dir/                      |
+-----+------+                  ^                               |
      |                         |                    +----------v--------+
      |                         |                    |       splunk      |
+-----v------+                  |                    +-------------------+
|   syslog   +------------------+                     http://splunk:8000/
+------------+

Unattended/Non-Splunk Usage

For unattended builds or lcp-compose usage without splunk services, the user can preserve the log directory for manual inspection/tailing.

Limitations

Configuration

Syslog configuration and Splunk configurations are stored in lcp-compose and can be inspected at .lcp-compose/configuration/ under the directories "splunk", "splunkforwarder", and "syslog".