Collecting Docker Container Logs
The easiest way for applications running in a Docker container to log to Seq is to use a native logging library and HTTP ingestion. Some applications, however, will choose to write plain text or JSON to STDOUT
or STDERR
, and have the Docker logging infrastructure route this to an appropriate log file or collector.
Seq supports the Docker logging infrastructure by accepting events in the GELF format.
GELF ingestion must be explicitly enabled in Seq using these instructions.
The output from any Docker container can be collected by configuring its logging driver on startup:
docker run \
--rm \
-it \
--log-driver gelf \
--log-opt gelf-address=udp://seq.example.com:12201 \
hello-world:latest
In this example, --log-driver gelf
instructs Docker to output logs using the GELF logging driver, while --log-opt gelf-address=udp://seq.example.com:12201
directs Docker to send logs via UDP to the specified host/port pair.
Updated about 1 year ago