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

Labels (1)
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
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...