Skip to content

Instantly share code, notes, and snippets.

@drozzy
Last active March 4, 2021 16:31
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save drozzy/06d1b2e48beac9527f5777cd1cd02492 to your computer and use it in GitHub Desktop.
Save drozzy/06d1b2e48beac9527f5777cd1cd02492 to your computer and use it in GitHub Desktop.
Docker Compose example of Logspout and OKLog

This is an example of how to automatically log all the messages from docker containers. Logspout listens to containers and automatically routes the logs to OKLog.

To run the example simply issue:

docker-compose up -d

command. The test service here is simply to genereate a "Hello World" message. You would replace this with other services that are in your compose files.

You can browse UI here (there seem to be some issues with UI here, I'm not getting very consistent behavior):

http://localhost:7650/ui/

version: "3"
volumes:
oklog:
services:
test:
image: ubuntu:latest
command: echo Hello World
depends_on:
- logspout
logspout:
image: gliderlabs/logspout
command:
- "syslog+tcp://oklog:7651"
ports:
- "8000:80"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock"
depends_on:
- oklog
networks:
- logging
oklog:
image: oklog/oklog
volumes:
- oklog:/data
ports:
- 7650:7650
command: ingeststore -store.segment-replication-factor 1
networks:
- logging
# We need a common network because logspout sends data to oklog
networks:
logging:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment