csv - Logstash 2.0: How to drop a failed parse event? -


my logstash config file parses csv file contains blank lines , other lines not match csv filter. logstash generates following error when encountering blank line:

"trouble parsing csv {:source=>"message", "raw"=>"", "exception=>#, :level=>:warn}"

how skip blank or empty line in logstash? how skip events fail parsed?

first, drop events know invalid, blank lines:

filter {     if [message] =~ /^$/ {         drop { }     } } 

if there other kinds can drop (comment lines start "#", etc), well.

you may want know other "unparsable" lines. if don't want put them index, consider sending them file. don't recall if csv filter indicates success/failure, can yourself:

csv {     ...     add_tag => [ "csvok" ] } 

this tag added if csv filter worked. output events different location:

output {     if "csvok" in [tags] {          elasticsearch {              ...          }     }     else {          file {              ...          }     }  } 

[ note: pseudo-code ]


Comments

Popular posts from this blog

authentication - Mongodb revoke acccess to connect test database -

r - Update two sets of radiobuttons reactively - shiny -

ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -