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
Revered Legend

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!

Splunk Enterprise Security 8.0.2 Availability: On cloud and On-premise!

A few months ago, we released Splunk Enterprise Security 8.0 for our cloud customers. Today, we are excited to ...

Logs to Metrics

Logs and Metrics Logs are generally unstructured text or structured events emitted by applications and written ...

Developer Spotlight with Paul Stout

Welcome to our very first developer spotlight release series where we'll feature some awesome Splunk ...