Splunk Search

How to write a search for my XML logs?

amanavohra
New Member

I have xml logs as below where I am trying to write a Splunk search to do a search where entry=01 and result = Done

<?xml version="1.0" encoding="utf-16"?>
<transaction name="test" version="1">
    <request>
        <id>123</id>
        <entry>01</entry>
    </request>
</transaction>
<?xml version="1.0" encoding="utf-16"?>
<transaction name="test" version="1">
    <response type="valid">
        <result>WIP</result>
</transaction>
<?xml version="1.0" encoding="utf-16"?>
<transaction name="test" version="1">
    <request>
        <id>123</id>
        <entry>02</entry>
    </request>
</transaction>
<?xml version="1.0" encoding="utf-16"?>
<transaction name="test" version="1">
    <response type="valid">
        <result>DONE</result>
</transaction>
Tags (2)
0 Karma

harish_ka
Communicator

If you just want to filter the events you can use this,
Index=yourIndex sourcetype=yourSourcetype "01" OR "DONE"

The above query will filter the events and display only events having entry=01 and result = Done.
Let me know if you are expecting a different answer...

0 Karma

somesoni2
SplunkTrust
SplunkTrust

Do you get each <transaction> block as separate event?

0 Karma

amanavohra
New Member

Yes, each <transaction> block is a separate event

0 Karma
Get Updates on the Splunk Community!

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...

Tech Talk | Elevating Digital Service Excellence: The Synergy of Splunk RUM & APM

Elevating Digital Service Excellence: The Synergy of Real User Monitoring and Application Performance ...

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...