Getting Data In

How to configure SEDCMD in props.conf to delete XML event content at index-time?

himynamesdave
Contributor

Hi all -

I have content in XML events I'm indexing that I don't want:

<?xml version="1.0" encoding="UTF-8"?>

So I decided to use sedcmd in my props.conf like follows:

SEDCMD-header = <\?xml version\=\"1\.0\" encoding\=\"UTF\-8\"\?>

Alas, it does not work. I feel it may be the regex that is failing, but I cannot seem to get it to click.

Can anyone help?

Tags (3)
1 Solution

somesoni2
Revered Legend

Try something like this in your props.conf on Indexer/Heavy Forwarder

[Yoursourcetype]
...Other configurations...
SEDCMD-aremoveheader = s/^\<\?xml[^\>]*\>\n*//g

View solution in original post

woodcock
Esteemed Legend

Try this:

 SEDCMD-header = s/<?xml version="1.0" encoding="UTF-8"?>//

You need to have a full sed command, in this case it says to switch your string with nothing.

0 Karma

somesoni2
Revered Legend

Try something like this in your props.conf on Indexer/Heavy Forwarder

[Yoursourcetype]
...Other configurations...
SEDCMD-aremoveheader = s/^\<\?xml[^\>]*\>\n*//g

landen99
Motivator

You want to make sure to capture the last ">" too. Maybe even the line characters afterwards.

SEDCMD-aremoveheader = s/^\<\?xml[^\>]*\>\n*//g

somesoni2
Revered Legend

Good catch. Just updated the my answer to reflect that.

0 Karma
Get Updates on the Splunk Community!

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...

.conf24 | Personalize your .conf experience with Learning Paths!

Personalize your .conf24 Experience Learning paths allow you to level up your skill sets and dive deeper ...

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...