Skip to content

Instantly share code, notes, and snippets.

@peacefixation
Last active March 27, 2019 01:38
Show Gist options
  • Save peacefixation/7bc65b72f0770c98035b7e1e23ccf894 to your computer and use it in GitHub Desktop.
Save peacefixation/7bc65b72f0770c98035b7e1e23ccf894 to your computer and use it in GitHub Desktop.
Test logstash filter with an input file
# test.conf
input {
file {
path => "/tmp/some-file.log"
start_position => beginning
sincedb_path => "/dev/null"
type => "some-type"
}
}
filter {
# Handles unprocessed entries
if [type] == "some-type" {
if "processed" not in [tags] {
add_tag => [ "processed" ]
}
}
}
output {
stdout { codec => json }
}
# validate
/usr/share/logstash/bin/logstash --path.settings /etc/logstash -f /tmp/test.conf --debug -t
# run
/usr/share/logstash/bin/logstash --path.settings /etc/logstash -f /tmp/test.conf --debug
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment