Splunk Search

How to exclude lines from a log --IndexQueue

IreneAsdfgk
Engager

We are trying to index only events that contain a certain structure set by a regular expression: \ S + \ s \ S + \ s \ ((\ S + | \ w + | ./ \ w +) ) : \ s (DATE | END | Running).
However, when we assign the indexQueue property in transforms.conf, it doesn't work:

[takedata]
REGEX = \ S + \ s \ S + \ s \ ((\ S + | \ w + | ./ \ w +) \) \: \ s (DATE | END | Running)
DEST_KEY = queue
FORMAT = indexQueue

If we do it with the nullQueue, we exclude the rows that correspond to that expression.

[excludedata]
REGEX = \ S + \ s \ S + \ s \ ((\ S + | \ w + | ./ \ w +) \) \: \ s (DATE | END | Running)
DEST_KEY = queue
FORMAT = nullQueue

Can any help us?

Thanks.

0 Karma
1 Solution

oscar84x
Contributor

You need to do both and in the specific order as explained in the link below. What this does is "send everything to the nullQueue, except the events that match this regex". Like this:

[your_sourcetype]
TRANSFORMS-set= excludedata,takedata

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

[takedata]
REGEX = \ S + \ s \ S + \ s \ ((\ S + | \ w + | ./ \ w +) ) : \ s (DATE | END | Running)
DEST_KEY = queue
FORMAT = indexQueue

https://docs.splunk.com/Documentation/SplunkCloud/8.0.0/Forwarding/Routeandfilterdatad#Filter_event_...

View solution in original post

oscar84x
Contributor

You need to do both and in the specific order as explained in the link below. What this does is "send everything to the nullQueue, except the events that match this regex". Like this:

[your_sourcetype]
TRANSFORMS-set= excludedata,takedata

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

[takedata]
REGEX = \ S + \ s \ S + \ s \ ((\ S + | \ w + | ./ \ w +) ) : \ s (DATE | END | Running)
DEST_KEY = queue
FORMAT = indexQueue

https://docs.splunk.com/Documentation/SplunkCloud/8.0.0/Forwarding/Routeandfilterdatad#Filter_event_...

IreneAsdfgk
Engager

'in the specific order ' has been the key for resolution. Thanks you very much!!!!!!!!

0 Karma

rashi83
Path Finder

@oscar84x @IreneAsdfgk

Can you let me know if you tweaked outputs.conf too ?
I am facing same issue - I can't filter in events to include events but exclude filter works. My config is running on standalone SH .
I added in outputs.conf too - how can I make it work ?

[tcpout:setparsing]
server=localhost:8000

Props.conf
[OktaIM2:log]
TRANSFORMS-set= setnull,setparsing

transforms.conf
[setnull]
REGEX=gmail.com
DEST_KEY=queue
FORMAT=nullQueue
[setparsing]
REGEX=yahoo.com
DEST_KEY=queue
FORMAT=indexQueue

0 Karma

oscar84x
Contributor

Excellent! Glad to help. If you have a chance please mark the answer as accepted.
Thank you.

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