Splunk Enterprise

Index only events matching with pattern and exclude everyting else

AKG1_old1
Builder

Hello,

In particular sourcetype we are getting huge numbers of events but only some data events are relevant. I am try to take only events with matching string and exclude everything else.

Matching strings :  Session initialization | Session initialized   (There are few more as well)   


I have tried this by refereing this post Link 

When I am using this its excluding everyting and when i tried only with setparsing its injesting all data. Not sure what I am missing here.

props.conf

[mx_java_event]
DATETIME_CONFIG =
LINE_BREAKER = ([\r\n]+)
NO_BINARY_CHECK = true
category = Custom
pulldown_type = true
EXTRACT-JavaClass = ,\d+\s\[(?<JavaClass>[^:]*):
EXTRACT-Session = session:(?<Session>\d+)
TRANSFORMS-set = setnull, setparsing

transforms.conf

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

[setparsing]
REGEX = Session initialization | Session initialized
DEST_KEY = queue
FORMAT = indexQueue

FYI : In case REGEX is incorrect, I tried with "REGEX = Session"  its not working either.

 

 

Sample data: (Only 1st and 3rd line are matching)

2020-08-12 14:08:11,775 [Thread-233 - Worker-54] murex.processing.stp.osp.server.service.OspServer : DEBUG - [session:1758555252] Session initialization - SGITOPS/SG_LAW_MRC
2020-08-12 14:08:12,775 [Thread-233 - Worker-54] murex.processing.stp.osp.server.service.OspServer : DEBUG - [session:1758555252] Excluded - SGITOPS/SG_LAW_MRC
2020-08-12 14:08:11,912 [Thread-233 - Worker-54] murex.processing.stp.osp.server.service.OspServer : DEBUG - [session:1758555252] Session initialized
2020-08-12 14:08:12,912 [Thread-233 - Worker-54] murex.processing.stp.osp.server.service.OspServer : DEBUG - [session:1758555252] Session Excluded2
2020-08-12 14:08:12,912 JUST FOR Testing

Labels (1)
0 Karma
1 Solution

thambisetty
SplunkTrust
SplunkTrust

props.conf

[mx_java_event]
TRANSFORMS-set = setnull, setparsing

transforms.conf 

NOTE:  if event contains "Session initialization" OR "Session initialized" anywhere then the event will be indexed others are ignored.

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

[setparsing]
REGEX = (Session initialization|Session initialized)
DEST_KEY = queue
FORMAT = indexQueue

 below is output from your sample events:

filter-events.png

————————————
If this helps, give a like below.

View solution in original post

0 Karma

thambisetty
SplunkTrust
SplunkTrust

Provide sample events to test regex.

————————————
If this helps, give a like below.
0 Karma

AKG1_old1
Builder

added sample data

0 Karma

thambisetty
SplunkTrust
SplunkTrust

props.conf

[mx_java_event]
TRANSFORMS-set = setnull, setparsing

transforms.conf 

NOTE:  if event contains "Session initialization" OR "Session initialized" anywhere then the event will be indexed others are ignored.

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

[setparsing]
REGEX = (Session initialization|Session initialized)
DEST_KEY = queue
FORMAT = indexQueue

 below is output from your sample events:

filter-events.png

————————————
If this helps, give a like below.
0 Karma
Get Updates on the Splunk Community!

Developer Spotlight with Paul Stout

Welcome to our very first developer spotlight release series where we'll feature some awesome Splunk ...

State of Splunk Careers 2024: Maximizing Career Outcomes and the Continued Value of ...

For the past four years, Splunk has partnered with Enterprise Strategy Group to conduct a survey that gauges ...

Data-Driven Success: Splunk & Financial Services

Splunk streamlines the process of extracting insights from large volumes of data. In this fast-paced world, ...