Getting Data In

XML metadata field extraction

jsanjeb
Explorer

Hi Splunkers,

I am working on field extraction for XML events. I have added regex in transforms.conf for extraction. XML looks like this,

<?xml version="1.0" encoding="UTF-8"?>
<transaction version="6.00" ID="1234" agentRole="sourceAgent" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="TransferLog.xsd" xmlns="">
    <field1 time="2018-03-30T19:53:34.472Z">abc</field1>
    <field2 agent="abc" QMgr="abc" agentType="abc">
        <systemInfo architecture="abc" name="abc" version="3.10.0-514.21.2.el7.x86_64"/>
    </field1>
    <field3 agent="abc" QMgr="abc"/>
    <originator>
        <field4>abc</field4>
        <field5>abc</field5>
        <field6>abc</field6>
    </originator>
    <transferSet startTime="2018-03-30T19:53:34.473Z" total="1" bytesSent="0">
        <metaDataSet>
            <metaData key="field7">abc</metaData>
            <metaData key="field8">abc</metaData>
            <metaData key="field9">abc</metaData>
            <metaData key="com.ibm.wmqfte.field10">abc</metaData>
            <metaData key="com.ibm.wmqfte.field11">abc</metaData>
            <metaData key="com.ibm.wmqfte.field12">abc</metaData>           
        </metaDataSet>
    </transferSet>
</transaction>

props.conf

[mft]
category = Custom
pulldown_type = 1
NO_BINARY_CHECK = true
disabled = false
REPORT-xmlkv = xmlkv-alternative

transforms.conf

 [xmlkv-alternative]
 REGEX = <([^\s\>]*)[^\>]*\>([^<]*)\<\/\1\>
 FORMAT = $1::$2

Using the above regex I am able extract tags named field1, field2, field3 field4, field5 and field6 in the XML. However remaining fields inside tag ie field7 to field12 in XML cannot be extracted. Exception here is i need not extract/ ignore all fields in this form com.ibm.wmqfte.field10. Please help me with this extraction.

Thanks

Tags (1)
0 Karma

785978
Engager

I am curios about this as well, i have a similar problem and trying to extract the field name from metadata 

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 ...