Skip to content

Instantly share code, notes, and snippets.

@martinsbalodis
Created March 1, 2017 13:09
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save martinsbalodis/28295a79dcb9de546138c9603e2dcb44 to your computer and use it in GitHub Desktop.
Save martinsbalodis/28295a79dcb9de546138c9603e2dcb44 to your computer and use it in GitHub Desktop.
Example of logging with docker gelf logger to logstash
---
version: '3'
services:
elasticsearch:
image: elasticsearch:5
kibana:
image: kibana:5
ports:
- "5601:5601"
logstash:
image: logstash:5
command: -e 'input { gelf {} } filter { json { source => "message" } date { match => ["timestamp", "UNIX"] } mutate { remove_field => [ "command", "created" ] } } output { elasticsearch { hosts => ["elasticsearch"] } stdout { } }'
ports:
- "12201:12201/udp"
service1:
image: php:7
command: [ "php", "-r", 'for(;;){echo json_encode(["message" => "asd", "timestamp" => time(), "level" => "info"])."\n"; sleep(1);}']
logging:
driver: gelf
options:
gelf-address: udp://localhost:12201
tag: service1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment