Splunk Search

To remove few details using rex

sgulhane5
Explorer

Hi Team,

I have three below conditions to create a logic according to it.

Case 1: operation="OVERRIDE" should print but not a name="IP BLOCK TYPE",value="Private"

Sample log for IP BLOCK TYPE: 

[name="IP BLOCK TYPE",value="Private",operation="OVERRIDE"] 

Case 2: operation="OVERRIDE" is not present in the logs at all

Sample log for IP BLOCK TYPE: 

[name="IP BLOCK TYPE",value="Public"] 

So for above two conditions I had used  below query to fetched the desired data>>

rex field=_raw "operation=\"(?<IP_Block_Type>.\w+)\"" | where isnotnull(IP_Block_Type)

 

Case 3: 

Sample log for IP BLOCK TYPE: 

[name="IP BLOCK TYPE",value="Public",descendants_action={option_with_ea:"INHERIT",option_without_ea:"NOT_INHERIT"},operation="OVERRIDE"] 

Case numbers 1 and 2 queries look good because those logs don't contain details like case 3 (e.g. descendants_action={option_with_ea:"INHERIT",option_without_ea:"NOT_INHERIT"}).  I tried the same filter but got to know that query is taking data from 3rd case also which is not required. So basically I don't want to print anything from case number 3. Please help to get the answers for this.

@gcusello 

@Nisha18789  

@ITWhisperer 

Thanks,

Labels (1)
Tags (1)
0 Karma

sgulhane5
Explorer

@to4kawa I just want to get case number 1, not 3. 3rd case has many other details including operation="OVERRIDE" so don't want this case to be check while using 

rex field=_raw "operation=\"(?<IP_Block_Type>.\w+)\"" | where isnotnull(IP_Block_Type)

 
0 Karma

to4kawa
Ultra Champion
index=_internal | head 1 | fields _raw | eval _raw="[name=\"IP BLOCK TYPE\",value=\"Public\",descendants_action={option_with_ea:\"INHERIT\",option_without_ea:\"NOT_INHERIT\"},operation=\"OVERRIDE\"] "
| kv

REX is not need, I guess.

0 Karma

sgulhane5
Explorer

@to4kawa Nope.. it is not working

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!

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...

Modernize your Splunk Apps – Introducing Python 3.13 in Splunk

We are excited to announce that the upcoming releases of Splunk Enterprise 10.2.x and Splunk Cloud Platform ...

Step into “Hunt the Insider: An Splunk ES Premier Mystery” to catch a cybercriminal ...

After a whole week of being on call, you fell asleep on your keyboard, and you hit a sequence of buttons that ...