Docker Logging
Docker Compose and OpenShift produce output in the current terminal at runtime. These are ephemeral and it also can be difficult to understand those errors.
In order to save logs, you need Docker Containers to store them. Using Graylog will handle those tasks. The following Docker Compose file shows an example configuration for Graylog.
version:
'2'
services:
graylog:
image: graylog2/allinone
ports:
-
9000
:
9000
-
12201
:
12201
logspout:
image:
"micahhausler/logspout:gelf"
hostname: apiomat
depends_on:
- graylog
command:
"gelf://graylog:12201"
environment:
LOGSPOUT: ignore
volumes:
-
"/var/run/docker.sock:/var/run/docker.sock"
This will send all output that occurs on the docker.sock to an instance of Graylog and will make the logs available, so that you can search for specific entries and archives them.