Splunk Search

Xml path extract field

Annna
Explorer

<Shipment Action>

<ShipmentLines>

<ShipmentLine PrimeLine="2" />

<ShipmentLine PrimeLine="3"/>

<ShipmentLine PrimeLine="4"/>

<ShipmentLine PrimeLine="1"/>

</ShipmentLines>

</Shipment Action>

in the above xml file i have to pick out the ShipmentLine count, some times ShipmentLine increases.

I have tried different rex combination without luck, any suggestions.

output:

ShipmentLine=4 count

 

Labels (1)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust
| rex max_match=0 "(?<ShipmentLine>ShipmentLine)\s"
| eval count=mvcount(ShipmentLine)

Since your elements don't appear to have any data (only attributes) spath/xpath will end up with empty fields which then can't be easily counted

View solution in original post

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust
| rex max_match=0 "(?<ShipmentLine>ShipmentLine)\s"
| eval count=mvcount(ShipmentLine)

Since your elements don't appear to have any data (only attributes) spath/xpath will end up with empty fields which then can't be easily counted

0 Karma

Annna
Explorer

Thank you so much 

0 Karma
Get Updates on the Splunk Community!

Webinar Recap | Revolutionizing IT Operations: The Transformative Power of AI and ML ...

The Transformative Power of AI and ML in Enhancing Observability   In the realm of IT operations, the ...

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...