Dashboards & Visualizations

How to filter XML in Heavy Forwarder

nagaraju_chitta
Path Finder

Hi Everyone,
Apologies for my post here since I am unable to post a new one question adding in this.
I have tough time to filter the data from my incoming xml in Heavy Forwarder and sending to Indexer.
considering content is my xml tag which need to be removed from the xml data in between the content tags

Below is the REGEx I am using in transforms.conf file

transforms.conf

[remove-content]
REGEX = s/(?s).*(?=<\/content>)<\/content>//
DEST_KEY = queue
FORMAT = nullQueue

Props.conf

[test_transform]
pulldown_type = 1
TRANSFORMS-null = remove-content
DATETIME_CONFIG = 
NO_BINARY_CHECK = true
category = Custom
disabled = false

still unable to achieve the results expected xml to index..googled so many posts and implemented ...but no luck

Tags (2)
0 Karma

somesoni2
Revered Legend

I'm guessing you're trying to strip some content of of your events, not all event. So, you should be using SEDCMD of props.conf, as the transforms that you're trying will remove the whole event

[test_transform]
 pulldown_type = 1
 SEDCMD-remove_content = s/(?s).*(?=<\/content>)<\/content>//
 DATETIME_CONFIG = 
 NO_BINARY_CHECK = true
 category = Custom
 disabled = false
0 Karma

lguinn2
Legend

You can't do a substitution within the REGEX; that is not allowed. Also, you can send entire events to the nullQueue, but not parts of events.

[remove-content]
REGEX=(.*?\<content\>).*?(\</content\>.*)
DEST_KEY=_raw
FORMAT = $1$2

Above, the REGEX captures everything up to and including the <content> tag. The it also captures everything from the </content> tag to the end of the event. It re-writes the raw event, using only the captured pieces of the original event and omitting the characters in between the tags.

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!

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...

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