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!

Persistent Queue at TcpOut — One of Splunk's Most Practical Features

Splunk introduced persistent queueing at the tcpout layer as one of the most practical resilience features in ...

Skip the Awkward Silence: Have a .conf-ersation at .conf26

Picture this. You arrive at .conf26 already having your socializing and networking plans mapped out. No ...

Rethinking Zero Trust: From Product Purchases to Logical Control Evidence

Implementing Zero Trust (ZT) across complex environments often falters at the very beginning due to a ...