Hello.
I've implement a filter where I read from a JMS queue a message that is an XML file.
Then, I use the XML plugin to map some fields with the paths of the XML as following:
xpath => [
"//Framework_Event/EventCode/text()", "EventCode",
"//Framework_Event/E2ERequestId/text()", "E2EId",
"//Framework_Event/ParentInstanceId/text()", "ParentAdapterInstanceId",
"//Framework_Event/InstanceId/text()", "AdapterInstanceId",
"//Framework_Event/CustomId/text()", "AdapterCustomId",
"//Framework_Event/Deepness/text()", "StageLevel",
"//Framework_Event/RequestTimeStamp/text()", "E2EStartTimeStamp",
]
As far as I know, this plugin always extracts an array from the indicated paths.
Then I extract the first element from the array:
mutate {
remove_field => [ "message" ]
replace => {
"EventCode" => "%{[EventCode][0]}"
"E2EId" => "%{[E2EId][0]}"
"ParentAdapterInstanceId" => "%{[ParentAdapterInstanceId][0]}"
"AdapterInstanceId" => "%{[AdapterInstanceId][0]}"
"AdapterCustomId" => "%{[AdapterCustomId][0]}"
"StageLevel" => "%{[StageLevel][0]}"
"E2EStartTimeStamp" => "%{[E2EStartTimeStamp][0]}"
}
the problem is that for those elements of the XML that are empty, the replace function is writing something like that in elastic:
"ParentAdapterInstanceId": "%{[ParentAdapterInstanceId][0]}",
How could I get a blank there instead of this?
many thanks in advance