Not able to parse XML string with logstash grok filter


(Shamim Ahmad) #1

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}"}
}
}


(Magnus B├Ąck) #2

Why not use the xml filter instead?


(system) #3

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