Testing logstash configs with Docker
Posted on June 28, 2016 (Last modified on July 11, 2024) • 1 min read • 118 wordsNow this is really not rocket science, but since I might do this more often, I don’t want to google every time.
./tmp # THIS IS YOUR WORKING DIRECTORY
|- patterns/ # optional
| |- patternfile1 # optional
| |- patternfile2 # optional
|- logs.log
|- logstash.conf
# logstash.conf
input {
file {
path => '/stash/logs.log'
}
}
filter {
# whatever config you want to test
grok {
match => [ "message", "%{WHATEVER}" ]
patterns_dir => '/stash/patterns' # optional :)
}
}
output {
stdout { codec => rubydebug }
}
docker run --rm -ti -v $(pwd):/stash logstash logstash -f /stash/logstash.conf
Done. 🙂