Created
March 1, 2017 13:09
-
-
Save martinsbalodis/28295a79dcb9de546138c9603e2dcb44 to your computer and use it in GitHub Desktop.
Example of logging with docker gelf logger to logstash
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
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