Getting Data In

Is it possible to remove data from an event before indexing?

rune_hellem
Contributor

I've been asked to index a new sourcetype which is a set of XML-files. The files contains a tag

<attachments>...</attachments>

which I want to skip, since it is of no value at all indexing the attachment as raw data...it just makes it harder to see the forest for all the trees.

Could this be done?

Update
Realized that the most obvious answer is "Preprocess the files, remove the tag then index the file", but still hoping that Splunk can be told to do this for me.

0 Karma
1 Solution

rsennett_splunk
Splunk Employee
Splunk Employee

In props.conf you can use the command:
SEDCMD

http://docs.splunk.com/Documentation/Splunk/6.2.4/Data/Anonymizedatausingconfigurationfiles#Anonymiz...

This doc talks about anonymizing data using a SED script... and what it does is match a pattern and replace it in the example.
You'll do the same, but replace it with nothing... You can try the effect using the Data onboarding wizard (Add Data)

But it would be something like this:

props.conf
SEDCMD - dumpAttach = /s\[^\<]+\<\/attachments\>//g

With Splunk... the answer is always "YES!". It just might require more regex than you're prepared for!

View solution in original post

rsennett_splunk
Splunk Employee
Splunk Employee

In props.conf you can use the command:
SEDCMD

http://docs.splunk.com/Documentation/Splunk/6.2.4/Data/Anonymizedatausingconfigurationfiles#Anonymiz...

This doc talks about anonymizing data using a SED script... and what it does is match a pattern and replace it in the example.
You'll do the same, but replace it with nothing... You can try the effect using the Data onboarding wizard (Add Data)

But it would be something like this:

props.conf
SEDCMD - dumpAttach = /s\[^\<]+\<\/attachments\>//g

With Splunk... the answer is always "YES!". It just might require more regex than you're prepared for!

rune_hellem
Contributor

That did the trick!!

0 Karma

rsennett_splunk
Splunk Employee
Splunk Employee

Great! 🙂

With Splunk... the answer is always "YES!". It just might require more regex than you're prepared for!
0 Karma
Get Updates on the Splunk Community!

Index This | Forward, I’m heavy; backward, I’m not. What am I?

April 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

A Guide To Cloud Migration Success

As enterprises’ rapid expansion to the cloud continues, IT leaders are continuously looking for ways to focus ...

Join Us for Splunk University and Get Your Bootcamp Game On!

If you know, you know! Splunk University is the vibe this summer so register today for bootcamps galore ...