Drop logs when there is a jsonparsefailure


#1

Hi,

I am trying to push some of our logs to elasticsearch via logstash. Can some one let me know how can I drop the logs in logstash itself if the logs are not in proper json format , before they are being pushed to elasticsearch.

I can see a _jsonparsefailure in thetagsarray. But I am not sure how to search in thetagsarray for_jsonparsefailurestring and drop the log event? Can someone let me know thefilter` config for the logstash?


(Magnus B├Ąck) #2
filter {
  if "_jsonparsefailure" in [tags] {
    drop { }
  }
}

See the conditionals documentation.


#3

Found in the logstash doc the in conditional

filter {
  if "_jsonparsefailure" in [tags] {
        drop { }
  }
}

#4

Thanks @magnusbaeck


(system) #5