Skip to content

Instantly share code, notes, and snippets.

@battleguard
Last active June 21, 2018 14:08
Show Gist options
  • Save battleguard/8213777fc1ca03a8deddae83bcc669cc to your computer and use it in GitHub Desktop.
Save battleguard/8213777fc1ca03a8deddae83bcc669cc to your computer and use it in GitHub Desktop.
Example usage of logspout routing docker logs to ELK
# Logspout portion of the ELK Demo locally
# Maintainer: Gary A. Stafford <[email protected]>
version: '3.1'
services:
elk:
image: garystafford/custom-elk:latest
ports:
- "5601:5601/tcp" # Kibana web interface
- "9200:9200/tcp" # Elasticsearch JSON interface
- "5000:5000/udp" # Logspout
logging:
driver: json-file
options:
max-size: 10m
environment:
LOGSPOUT: ignore
restart: unless-stopped
logspout:
image: bekt/logspout-logstash
environment:
DOCKER_LABELS: "show_lables"
ROUTE_URIS: "logstash://elk:5000"
LOGSPOUT: ignore
logging:
driver: json-file
options:
max-size: 10m
restart: unless-stopped
volumes:
- /var/run/docker.sock:/var/run/docker.sock
hello-logspout:
image: alpine
logging:
driver: json-file
command: >
ash -c "sleep 10s
&& echo hello alpine example"
depends_on:
- logspout
# to manually call hello-world you cannot have --rm or it will not store the log file
# example: docker run --log-driver json-file alpine echo hello world
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment