Created
August 23, 2014 22:11
-
-
Save alhafoudh/1b4803347efa36d586da to your computer and use it in GitHub Desktop.
Logstash watch docker logs
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
input { | |
file { | |
codec => json | |
path => '/var/lib/docker/containers/*/*-json.log' | |
} | |
} | |
filter { | |
ruby { | |
code => "Thread.current[event['path']] ||= JSON.parse(Pathname(event['path']).dirname.join('config.json').read)" | |
} | |
ruby { | |
code => "event['container_name'] = Thread.current[event['path']].fetch('Name', '<missing>')" | |
} | |
ruby { | |
code => "event['container_image'] = Thread.current[event['path']]['Config'].fetch('Image', '<missing>')" | |
} | |
} | |
output { | |
stdout { | |
codec => rubydebug | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment