I am trying to input JSON data from logs through logstash to Elasticsearch but I am getting this error field:[array][method] is of type = NilClass" Preformatted text
Please find my logstash conf file-
input {
http {
host => "localhost"
port => 5290
}
}
filter {
mutate{
rename => {
"[headers][logtype]" => "logtype"
}
}
if [logtype] == "alertservice" {
split {
field => "array"
}
mutate{
rename => {
"[array][tenant]" => "tenant"
"[array][username]" => "username"
"[array][machinename]" => "machinename"
"[array][severity]" => "severity"
"[array][eventid]" => "eventid"
"[array][logid]" => "logid"
"[array][eventtype]" => "eventtype"
"[array][eventtime]" => "eventtime"
"[array][domain]" => "domain"
"[array][details]" => "details"
"[array][collection]" => "collection"
}
remove_field => [ "array" ]
}
}
date {
match => [ "timestamp", "UNIX_MS" ]
}
mutate {
convert => {
"timestamp" => "integer"
}
}
mutate {
add_field => ["month","%{+MM}","year","%{+YYYY}","day","%{+dd}"]
}
mutate {
convert => {
"day" => "integer"
"month" => "integer"
"year" => "integer"
}
}
mutate {
remove_field => [ "message", "@version", "host", "headers", "tags" ]
remove_tag => [ "message", "@version", "host", "headers", "tags" ]
}
}
output {
stdout {
codec => rubydebug
}
elasticsearch {
index => "%{tenant}"
hosts => ["localhost:9200"]
manage_template => false
}
}
How to fix this?