logging - Logstash parsing different action with different logs -
i using logstash parse logs.
now want handle logs match particular regex differently , dont differently.
is achievable logstash.
how go it?
my configuration file is:
input { stdin { type => "stdin-type" } } filter { grok { type => "stdin-type" patterns_dir=>["./patterns"] pattern => "%{parse_error}" add_tag=>"%{type1},%{type2},%{slave},err_system" } date { replace=>["%{ts}","yyyy/mm/dd-hh:mm:ss.sss"] custom_timestamp=>[%{ts}] } mutate { type=>"stdin-type" replace => ["@message", "%{message}" ] } } output { stdout { debug => true debug_format => "json"} elasticsearch { } }
say dont want put logs in elastic search not match regex. possible? how?
yes, can conditionals either in filter{} section or output{} section:
filter { if [field] == "value" { drop{} } }
or
output { if [field] != "value" { elasticsearch { ... } } }
Comments
Post a Comment