Installation

Limited data extraction from _raw events

SplunkDash
Motivator

Hello,

I need some recommendations on how to extract  limited amount of _raw data based on some search criteria.  My requirements and one sample _raw event/data are given below. Any help will be highly appreciated. Thank you!

My requirements:

Following is one sample event, I have a key search object   "Operation Succeeded"  (see second line of the event from the last) and my objectives from this search

1. Need to get all  events those have  "Operation Succeeded" 

2. Need to display one line that has "Operation Succeeded" only. For example, search will display only " ----AUDIT-1044-036936275288 -- 2021/10/05 08:58:24.289 Operation Succeeded"  (will ignore the rest)  for that event and same for rest of the events those have "Operation Succeeded" match.

Sample Data:

--AUDIT-1044-036936275170 -- 2021/10/05 08:58:24.289 Attempting to set  option 'auditing'

----AUDIT-1044-036936275196 -- 2021/10/05 08:58:24.289 Checking SET ANY OPTION system privilege or authority - OK

----AUDIT-1044-036936275242 -- 2021/10/05 08:58:24.289 Checking SET ANY SECURITY OPTION system privilege or authority - OK

----AUDIT-1044-036936275288 -- 2021/10/05 08:58:24.289 Operation Succeeded

----AUDIT-1044-036936275305 -- 2021/10/05 08:58:24.289 Auditing Disabled

Tags (1)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust
| rex "(?<line>----AUDIT-\S+\s--\s\S+\s\S+\sOperation Succeeded)"

View solution in original post

ITWhisperer
SplunkTrust
SplunkTrust
| rex "\n?(?<line>.*?Operation Succeeded)"
| table line
0 Karma

SplunkDash
Motivator

Hello,

Thank you so much, it's really helpful. However, it only extract  Operation Succeeded  from that event, that looks great. But there is any way I can have the whole line of text (like below) instead:  

----AUDIT-1044-036936275288 -- 2021/10/05 08:58:24.289 Operation Succeeded

  Thank you...any appreciate your support in these efforts.

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Try without the optionality on the newline

| rex "\n(?<line>.*?Operation Succeeded)"
0 Karma

SplunkDash
Motivator

Hello,

Thank you so much again.....yes, I tried, but, getting blank without optionality with \n.  

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

What do you get with this?

| regex _raw="Operation Succeeded"
| table _raw

 

0 Karma

SplunkDash
Motivator

Hello,

I am getting complete length of all _raw events (with all elements/full text) which have "Operation Succeeded"......key word!

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust
| rex "(?<line>----AUDIT-\S+\s--\s\S+\s\S+\sOperation Succeeded)"

SplunkDash
Motivator

Hello,

Yes, it's working as expected, thank you so much...truly appreciated.....just  one more question on this issue, is there any way I can limit (truncate/trim) the length of the _raw event from search head queries.....thank you again...

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Mastering Threat Intelligence in ES 8.5, Splunk AI Assistant v2, and More from Splunk ...

Splunk Lantern is Splunk’s customer success center that provides practical guidance from Splunk experts on key ...

Break the Build: Inside the KubeDoom Lounge at .conf26

    You step up to the machine. The pixelated corridors of a certain 1993 FPS load in front of you, EMP Pulse ...

Splunk Auto Ingestion Parallel Pipeline Scaling

Why this feature matters Many Splunk environments experience ingestion pressure long before the host is fully ...