Splunk Search

Filtering Unwanted Events

daniel_augustyn
Contributor

I've been trying to filter unwanted events on a heavy forwarder from being sent to indexers. I followed the instructions which I found in here http://docs.splunk.com/Documentation/Splunk/6.4.3/Forwarding/Routeandfilterdatad, more specifically, I followed this:

Keep specific events and discard the rest
This scenario is opposite to the previous scenario. In this example, you use two transforms to keep only the sshd events. One transform routes sshd events to indexQueue, while another routes all other events to nullQueue.

Note: In this example, the order of the transforms in props.conf matters. The null queue transform must come first; if it comes later, it will invalidate the previous transform and route all events to the null queue.

  1. In props.conf:

[source::/var/log/messages]
TRANSFORMS-set= setnull,setparsing
2. In transforms.conf:

[setnull]
REGEX = .
DEST_KEY = queue
FORMAT = nullQueue

[setparsing]
REGEX = [sshd]
DEST_KEY = queue
FORMAT = indexQueue
1. Restart Splunk Enterprise.

But it doesn't work, can someone tell me where is the issue? This is my stanza:

props.conf

[source::/var/log/messages]
TRANSFORMS-null = setnull, setparsing

transforms.conf

[setnull]
REGEX = .
DEST_KEY = queue
FORMAT = nullQueue

[setparsing]
REGEX = splunk_agent.py
DEST_KEY = queue
FORMAT = indexQueue

Tags (1)
0 Karma
1 Solution

jconger
Splunk Employee
Splunk Employee

Just a quick first guess, it looks like your REGEX is wrong for [setparsing]. The "." is a special character for regex, so you need to escape it like so:

REGEX = splunk_agent\.py

View solution in original post

woodcock
Esteemed Legend

This should work (although you should escape the . character as the other answer indicates. This should be deployed to your Indexers and each splunk instance there has to be bounced. Even so ONLY DATA THAT IS INDEXED AFTER THE BOUNCE will be correct. The earlier data is already in and will not be effected.

0 Karma

jconger
Splunk Employee
Splunk Employee

Just a quick first guess, it looks like your REGEX is wrong for [setparsing]. The "." is a special character for regex, so you need to escape it like so:

REGEX = splunk_agent\.py
Get Updates on the Splunk Community!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...