Deployment Architecture

Regex help

osasfrancis
Path Finder

HI,

In the below event example

 

7/8/2021 12:21:17 PM 111C PACKET 0000020BF8B054E0 UDP Snd xx.xx.xx.xx d6b8 R Q [8085 A DR NOERROR] AAAA (13)PC-3QZT282-D(7)system(2)us(0)

7/8/2021 12:21:17 PM 111C PACKET 0000020BF8B054E0 UDP Snd xx.xx.xx.xx d6b8 R Q [8085 A DR NOERROR] AAAA (13)PC-3QBVQ11-D(7)maintenance(2)us(0)

I am trying to have a regex that would exclude the first entry from being indexed. Below is the config i have

props.conf

[Test:system]                                                                                                                                                                                TRANSFORMS-null = setnull

 

transforms.conf

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

 

After restarting splunk on the heavy forwarder, it still indexes the first event with system in the event. 

Please assist. Thanks

 

Labels (1)
0 Karma

MKozanic
Path Finder

@osasfrancis,

I have tested this config on my test instance and seems to work perfectly for me.

Are you able to advise if there are any important details you may have missed about the set-up?

Or, can you provide more detail on what your source logs look like? - perhaps provide some more examples?

Tags (1)
0 Karma

MKozanic
Path Finder

@osasfrancis  - Sorry, I miss read your question.

looking more into this, it seems like what you have should be working.

In your props you have [Test:system]  does this match the sourcetype of the events you are trying to filter?

 

0 Karma

osasfrancis
Path Finder

Yes. It does match.

0 Karma

venkatasri
SplunkTrust
SplunkTrust

Hi @osasfrancis 

When you use the nullQueue the event matches with REGEX will be sent to nullQueue meaning they won't be ingested. In your case you wanted to retain event-1 and discard event-2 hence as @MKozanic  updated REGEX matches the second event that would be discarded if that is the unique pattern (.+maintenance.+).

---

An upvote would be appreciated if this reply helps you!

0 Karma

MKozanic
Path Finder

If I read your question correctly AND if your second line is consistent - you could try this instead: 

transforms.conf

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

 

FYI - regex101.com is your best friend for these sorts of issues: 
https://regex101.com/r/HSimiN/1

0 Karma
Get Updates on the Splunk Community!

Happy CX Day to our Community Superheroes!

Happy 10th Birthday CX Day!What is CX Day? It’s a global celebration recognizing innovation and success in the ...

Check out This Month’s Brand new Splunk Lantern Articles

Splunk Lantern is a customer success center providing advice from Splunk experts on valuable data insights, ...

Routing Data to Different Splunk Indexes in the OpenTelemetry Collector

This blog post is part of an ongoing series on OpenTelemetry. The OpenTelemetry project is the second largest ...