Getting Data In

Index specific tag from XML

michaelrosello
Path Finder

I'm trying to index only a few fields from my XML Data but I cannot make it work using props and transform

Here is my sample xml data.

<ase:aseXML xmlns:ase="urn:aseXML:r36" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:aseXML:r36 http://www.nemmco.com.au/asexml/schemas/r36/aseXML_r36.xsd">;
   <Header>
      <From>EEE</From>
      <To>EEQ</To>
      <MessageID>-MSG-62350571</MessageID>
      <MessageDate>2018-05-28T11:48:58.865+10:00</MessageDate>
      <TransactionGroup>OWNX</TransactionGroup>
      <Priority>Medium</Priority>
      <SecurityContext>EGG</SecurityContext>
      <Market>NEM</Market>
   </Header>
   <Transactions>
      <Transaction transactionDate="2018-05-28T11:48:52.029+10:00" transactionID="ERGONETP-TNS-222754923">
         <MeterFaultAndIssueNotification version="r36">
            <NMI checksum="4">3053066985</NMI>
            <DateIdentified>2018-05-28</DateIdentified>
            <SupplyOn>Yes</SupplyOn>
            <ReasonForNotice>Other</ReasonForNotice>
            <Notes>NOTES.</Notes>
         </MeterFaultAndIssueNotification>
      </Transaction>
   </Transactions>
</ase:aseXML>

I only need to index this fields

     <MessageID>-MSG-62350571</MessageID>
           <MessageDate>2018-05-28T11:48:58.865+10:00</MessageDate>
           <TransactionGroup>OWNX</TransactionGroup>

and here is my props and transform

props.conf
[msatt]
NO_BINARY_CHECK = true
category = Custom
pulldown_type = 1
TRUNCATE = 0
disabled = false
MAX_EVENTS = 5000
TRANSFORMS-set-nullqueue=set_index,set_nullqueue

transforms.conf

[set_nullqueue]
REGEX=.
DEST_KEY=queue
FORMAT=nullQueue

[set_index]
REGEX = <MessageID>(?<MessageID>.*)<\/MessageID>\s+<MessageDate>(?<MessageDate>.*)<\/MessageDate>\s+<TransactionGroup>(?<TransactionGroup>.*)\/TransactionGroup>
DEST_KEY = queue
FORMAT = indexQueue
0 Karma

niketn
Legend

@michaelrosello, from the sample XML data, which nodes you want to drop and what do you need to retain?

Do you want to index only transactions i.e. <Transactions>....</Transactions>?

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma

michaelrosello
Path Finder

ohhh. sorry forgot to add what i want to index.

I want to index only this three values.

-MSG-62350571
2018-05-28T11:48:58.865+10:00OWNX

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!

Modernize your Splunk Apps – Introducing Python 3.13 in Splunk

We are excited to announce that the upcoming releases of Splunk Enterprise 10.2.x and Splunk Cloud Platform ...

Step into “Hunt the Insider: An Splunk ES Premier Mystery” to catch a cybercriminal ...

After a whole week of being on call, you fell asleep on your keyboard, and you hit a sequence of buttons that ...

SplunkTrust Application Period is Officially OPEN!

It's that time, folks! The application/nomination period for the 2026-2027 SplunkTrust is officially open. If ...