I currently have 2 different type of log formats coming in Json format.
message{
id:scenario1
ip:0.0.0.
}
message
{
id:scenario2
message: "This is a message field coming from application"
}
json {
source => "message"
skip_on_invalid_json => true
}
Situation 1:
Does not include any message field in it.
For this: I want to remove the message field as it contains the raw json message.
Situation 2:
Includes a message field with some application data in it. For this scenario the above code works fine. It replaces the message field with the data that is coming in.
For situation 1 the raw data is getting published to elastic search. I tried writing some thing like this
json {
source => "message"
tartget => parsedJson
skip_on_invalid_json => true
}
if ![parsedJson][message]
{
mutate {
remove_field => ["message"] ---This is raw data
}
But every thing is getting tagged with parsedjson.id and so on..
Any inputs are appreciated.