Dashboards & Visualizations

How do I read XML tags from Splunk?

rohithshettyge
Engager

I have uploaded the below XML data into Splunk Light. Can someone give me a query to get only the value from the tag ? So I can create a dashboard from this result that if MessageID has values, the request reached the destination.

<part name="reqdata"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <CreateOrderRequest
        xmlns=""
        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
        <TransactionHeader>
            <Action>CREATE</Action>
            <MessageID>1-6348871101_01/07/2019 05:52:27
            </MessageID>
            <SourceApplication>SRS1</SourceApplication>
            <SourceComponent>Submit Order</SourceComponent>
            <TargetApplication>XXX</TargetApplication>
            <TargetComponent>Submit Order</TargetComponent>
        </TransactionHeader>

    </CreateOrderRequest>
</part>
Tags (3)

mayurr98
Super Champion

Hi,

spath would definitely work but that would also create unnecessary fields if you are just interested in MessageID then you can try this:

index=<your_index> |  rex field=_raw "\<MessageID\>(?<MessageID>[^\<]+)" | search MessageID=*

let me know if this helps!

0 Karma

harsmarvania57
Ultra Champion

Hi @rohithshettyge,

You can use spath in your query so your query will be like this

<yourBaseQuery> | spath

Here is run anywhere search

| makeresults
 | eval _raw="<part name=\"reqdata\"
    xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">
    <CreateOrderRequest
        xmlns=\"\"
        xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"
        xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">
        <TransactionHeader>
            <Action>CREATE</Action>
            <MessageID>1-6348871101_01/07/2019 05:52:27
            </MessageID>
            <SourceApplication>SRS1</SourceApplication>
            <SourceComponent>Submit Order</SourceComponent>
            <TargetApplication>XXX</TargetApplication>
            <TargetComponent>Submit Order</TargetComponent>
        </TransactionHeader>

    </CreateOrderRequest>
</part>"
| spath
0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

[Puzzles] Solve, Learn, Repeat: Matching cron expressions

This puzzle (first published here) is based on matching timestamps to cron expressions.All the timestamps ...

Design, Compete, Win: Submit Your Best Splunk Dashboards for a .conf26 Pass

Hello Splunkers,  We’re excited to kick off a Splunk Dashboard contest! We know that dashboards are a primary ...

May 2026 Splunk Expert Sessions: Security & Observability

Level Up Your Operations: May 2026 Splunk Expert Sessions Whether you are refining your security posture or ...