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!

Mastering Threat Intelligence in ES 8.5, Splunk AI Assistant v2, and More from Splunk ...

Splunk Lantern is Splunk’s customer success center that provides practical guidance from Splunk experts on key ...

Break the Build: Inside the KubeDoom Lounge at .conf26

    You step up to the machine. The pixelated corridors of a certain 1993 FPS load in front of you, EMP Pulse ...

Splunk Auto Ingestion Parallel Pipeline Scaling

Why this feature matters Many Splunk environments experience ingestion pressure long before the host is fully ...