# How to add ignore node attribute when using xml filter plugin to translate xml to json?

**URL:** <https://discuss.elastic.co/t/how-to-add-ignore-node-attribute-when-using-xml-filter-plugin-to-translate-xml-to-json/107903>\
**Category:** Logstash\
**Created:** [November 16, 2017, 10:32am UTC](https://discuss.elastic.co/t/how-to-add-ignore-node-attribute-when-using-xml-filter-plugin-to-translate-xml-to-json/107903 "2017-11-16T10:32:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![yunmao](https://avatars.discourse-cdn.com/v4/letter/y/278dde/32.png) [@yunmao](https://discuss.elastic.co/u/yunmao)\
**Post date:** [November 16, 2017, 10:32am UTC](https://discuss.elastic.co/t/how-to-add-ignore-node-attribute-when-using-xml-filter-plugin-to-translate-xml-to-json/107903/1 "2017-11-16T10:32:45Z")

</div>

I use http input plugin to listen on port 8080, then I passing in POST http request with XML body. Then I use xml plugin to translate it into json. But for some nodes of the XML, they have attributes with namespace information, how could I ignore them when transforming?

Here is the XML body:  
  
\<SAM\_BASE xmlns="[XXX Sex - Free Porn Videos at XXX.com](http://www.xxx.com/xxxx)" xmlns:xsi="[http://www.w3.org/2001/XMLSchema-instance](http://www.w3.org/2001/XMLSchema-instance)"\>  
\<BASE\_IMAGE\_ID\>46\</BASE\_IMAGE\_ID\>  
\<SAM\_IMAGE\_ID\>7339690\</SAM\_IMAGE\_ID\>  
\<SAM\_IMAGE\_NAME\>redhat7.1\</SAM\_IMAGE\_NAME\>  
\<SAM\_POOL\_ID\>9\</SAM\_POOL\_ID\>  
\<SAM\_BASEID\>48\</SAM\_BASEID\>  
\</SAM\_BASE\>  
\</SAM\_BASEMboSet\>

My config file:

> input {  
> http{  
> host =\> "0.0.0.0"  
> port =\> "8080"  
> }  
> }
> 
> filter {  
> xml {  
> source =\> "message"  
> remove\_namespaces =\> true  
> suppress\_empty =\> true  
> target =\> "message"  
> }  
> }
> 
> output {  
> stdout{codec =\> rubydebug}  
> }

std output expected:

> {  
> "@version" =\> "1",  
> "host" =\> "x.xxx.xx.xxx",  
> "headers" =\> {  
> "http\_version" =\> "HTTP/1.1",  
> "http\_connection" =\> "keep-alive",  
> "request\_method" =\> "POST",  
> "http\_host" =\> "x.xx.xx.xx:8080",  
> "request\_uri" =\> "/",  
> "http\_user\_agent" =\> "xxxxxxxxxxxxx",  
> "http\_accept\_language" =\> "null",  
> "http\_accept" =\> "_/_",  
> "content\_type" =\> "application/xml",  
> "http\_x\_rbt\_optimized\_by" =\> "e8i-wx-sh4 (RiOS 9.1.3) SC",  
> "request\_path" =\> "/",  
> "content\_length" =\> "xxx"  
> },  
> "@timestamp" =\> 2017-11-16T10:10:49.682Z,  
> "message" =\> {  
> "SAM\_BASE" =\> [  
> [0] {  
> "SAM\_POOL\_ID" =\> [  
> [0] "9"  
> ],  
> "SAM\_IMAGE\_NAME" =\> [  
> [0] "redhat7.1"  
> ],  
> "SAM\_BASEID" =\> [  
> [0] "48"  
> ],  
> "BASE\_IMAGE\_ID" =\> [  
> [0] "46"  
> ],  
> "SAM\_IMAGE\_ID" =\> [  
> [0] "7339690"  
> ]  
> }  
> ],  
> }  
> }

---

<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:** [December 14, 2017, 10:33am UTC](https://discuss.elastic.co/t/how-to-add-ignore-node-attribute-when-using-xml-filter-plugin-to-translate-xml-to-json/107903/2 "2017-12-14T10:33:08Z")

</div>

Closed on December 14, 2017, 10:33am UTC

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