If you are using Logstash, you can use json filter. It will parse only the json formatted events and rest will throw parse failure error and this error can be detected by _jsonparsefailure tag in the output.
Before indexing the output to ElasticSearch, you can have a conditional as below to ignore parse failures.
output{
if "_jsonparsefailure" not in [tags] {
elasticsearch{
hosts => [ "localhost:9200" ]
index => [ "index_name-%{+YYYY.MM.dd}" ]
}
}
}
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.