# XML Plugin and xpath usage

**URL:** <https://discuss.elastic.co/t/xml-plugin-and-xpath-usage/202541>\
**Category:** Logstash\
**Created:** [October 7, 2019, 1:23pm UTC](https://discuss.elastic.co/t/xml-plugin-and-xpath-usage/202541 "2019-10-07T13:23:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ajojohnk](https://avatars.discourse-cdn.com/v4/letter/a/7993a0/32.png) [@ajojohnk](https://discuss.elastic.co/u/ajojohnk)\
**Post date:** [October 7, 2019, 1:23pm UTC](https://discuss.elastic.co/t/xml-plugin-and-xpath-usage/202541/1 "2019-10-07T13:23:20Z")

</div>

On XML filter

1. How is the event been decided by the logstash for its processing ?
2. In my following input xml, how should I flatten this xml using xpath to ingest json to ES

My case data:

Prferred json outcome to ingest into ES :

{  
OBJECT\_NAME : "CLISTATS"  
HEAP\_ID : "CLISTATS.0'"  
ZOBJNAME: "POWERPOINTVIEW\_P"  
ZOBJDOMN: "INBOUND"  
}  
{  
OBJECT\_NAME : "CLISTATS"  
HEAP\_ID : "CLISTATS.1'"  
ZOBJNAME: "POWERPOINTVIEW\_P"  
ZOBJDOMN: "INBOUND"  
}  
}

Logstash config file I've been trying with different combinations, but not fructifying .Appreciate any pointers on this ?

input {  
beats {  
port =\> 5044  
}  
}  
filter{  
xml {  
target =\> "doc"  
store\_xml =\> false  
source =\> "message"  
xpath =\> [ "/RMP/OBJECT/@NAME", "OBJECT\_NAME" ,  
"/RMP/OBJECT//HEAP/@id" , "HEAP\_ID" ,  
"/RMP/OBJECT/HEAP/FIELD/@NAME" , "FIELD\_NAME" ,  
"/RMP/OBJECT/HEAP/FIELD/@VALUE" , "FIELD\_VALUE"  
]  
mutate {  
remove\_field =\> ["@version", "path", "tags", "type", "agent", "ecs" , "input", "log"]  
}  
}  
output {  
stdout { codec =\> rubydebug }  
}

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [November 4, 2019, 1:23pm UTC](https://discuss.elastic.co/t/xml-plugin-and-xpath-usage/202541/2 "2019-11-04T13:23:36Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
