I have a log file that's an array of objects that looks something like this:
[
{ "cate1": "data1a", "cate2": "data2a" },
{ "cate1": "data1b", "cate2": "data2b" },
{ "cate1": "data1c", "cate2": "data2c" }
]
and I need each object in the array to be a separate entry in Elasticsearch and each "cate" to be a field. My current logstash.conf file is:
input {
tcp {
port => 5000
}
}
## Add your filters / logstash plugins configuration here
filter {
json {
source => "message"
target => "event"
}
mutate {
gsub => ["message","\]",""]
gsub => ["message","\[",""]
}
}
output {
elasticsearch {
hosts => "elasticsearch:9200"
}
}
but it tags each line with "_jsonparsefailure" except the first entry and it parses the square brackets as well. How would I go about configuring Logstash to do this properly?