Hi All,
I am struggling to grasp something here. My use case is this - i am using logstash and elasticsearch to log every request that comes through my API. Whenever my api processes a request, I log the headers, and the json body of the response along with some metadata ( clientip, url, etc.) and send it to logstash in json format.
What is happening is Elasticsearch is indexing each element of the json body into a field instead of indexing the body into one field. What I would like is to have one field in elasticsearch APILog.res.body that contains in the json represented as a string. Is there a way I can convert the APILog.res.body object into a string? I cannot seem to make it work with mutate - I have the following filters to no effect. Can anyone provide some guidance on how to achieve this?
mutate {
convert => {"%{[APILog][res][body]}" => "string"}
}
mutate {
replace => {"%{[APILog][res][body]}" => "[APILog][resp][body]"}
}
Example Log
"APILog": {
"res": {
"statusCode": 200,
"body": {
"MyAPiResponse": {
"Results": {
"Results": [
{
"Result1": "1E6C7B9670A60331994D005056BD0622",
"Result2": "160820",
"Result3": "ACTV"
}
]
}
}
}
},
"clientip": "10.0.0.0",
"header": "my header"
}