# Not able to parse XML string with logstash grok filter

**URL:** <https://discuss.elastic.co/t/not-able-to-parse-xml-string-with-logstash-grok-filter/67591>\
**Category:** Logstash\
**Created:** [November 30, 2016, 9:55am UTC](https://discuss.elastic.co/t/not-able-to-parse-xml-string-with-logstash-grok-filter/67591 "2016-11-30T09:55:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![shamimhaider33](https://avatars.discourse-cdn.com/v4/letter/s/b19c9b/32.png) [@shamimhaider33](https://discuss.elastic.co/u/shamimhaider33)\
**Post date:** [November 30, 2016, 9:55am UTC](https://discuss.elastic.co/t/not-able-to-parse-xml-string-with-logstash-grok-filter/67591/1 "2016-11-30T09:55:18Z")

</div>

I am trying to parse the XML string data usign Grok but looks like I am doing something wrong, please help me on this.

**XML String Data :**  
`<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?><a><expirationDate xmlns=\"http://epcis.abc.com/extension\">2019-05-15</expirationDate><lotNumber xmlns=\"http://epcis.abc.com/extension\">LOT-1047</lotNumber><productionDate xmlns=\"http://epcis.abc.com/extension\">10/10/2016 10:25:57</productionDate><quantity1 xmlns=\"http://epcis.abc.com/extension\">1,047</quantity1><EXT1 xmlns=\"http://epcis.abc.com/extension\">EXT1</EXT1><EXT2 xmlns=\"http://epcis.abc.com/extension\">EXT2</EXT2><EXT3 xmlns=\"http://epcis.abc.com/extension\">EXT3</EXT3><EXT4 xmlns=\"http://epcis.abc.com/extension\">EXT4</EXT4><EXT5 xmlns=\"http://epcis.abc.com/extension\">EXT5</EXT5><EXT6 xmlns=\"http://epcis.abc.com/extension\">EXT6</EXT6><EXT7 xmlns=\"http://epcis.abc.com/extension\">EXT7</EXT7><EXT8 xmlns=\"http://epcis.abc.com/extension\">EXT8</EXT8><EXT9 xmlns=\"http://epcis.abc.com/extension\">EXT9</EXT9><EXT10 xmlns=\"http://epcis.abc.com/extension\">EXT10</EXT10><EXT11 xmlns=\"http://epcis.abc.com/extension\">EXT11</EXT11><EXT12 xmlns=\"http://epcis.abc.com/extension\">EXT12</EXT12><EXT13 xmlns=\"http://epcis.abc.com/extension\"><EXT xmlns=\"http://epcis.abc.com\">EXT13</EXT></EXT13><EXT14 xmlns=\"http://epcis.abc.com/extension\"><EXT xmlns=\"http://epcis.abc.com\">EXT14</EXT></EXT14><EXT15 xmlns=\"http://epcis.abc.com/extension\"><EXT xmlns=\"http://epcis.abc.com\">EXT15</EXT></EXT15><EXT16 xmlns=\"http://epcis.abc.com/extension\"><EXT xmlns=\"http://epcis.abc.com\">EXT16</EXT></EXT16></a>`

**filter**

> filter {  
> grok {  
> match =\> {"message"=\>"\<expirationDate xmlns=\"[http://epcis.abc.com/extension\\"\>%{GREEDYDATA:expirationDate}\</expirationDate\>"](http://epcis.abc.com/extension%5C%5C%22%3E%25%7BGREEDYDATA:expirationDate%7D%3C/expirationDate%3E%22)}  
> }  
> }

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [November 30, 2016, 12:20pm UTC](https://discuss.elastic.co/t/not-able-to-parse-xml-string-with-logstash-grok-filter/67591/2 "2016-11-30T12:20:01Z")

</div>

Why not use the xml filter instead?

---

<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 28, 2016, 12:20pm UTC](https://discuss.elastic.co/t/not-able-to-parse-xml-string-with-logstash-grok-filter/67591/3 "2016-12-28T12:20:02Z")

</div>

Closed on December 28, 2016, 12:20pm UTC

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