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!

Free Professional Services for .conf26 Attendees

This year at .conf26, we are doing something a little different. We are bringing the best minds from ...

Defend at Machine Speed: Your Guide to Security Sessions at .conf26

Splunk .conf26   With threats moving at machine speed and attack surfaces expanding across hybrid ...

Where Innovation Takes Flight: The Splunk4Aviation Flight Sim Lands at .conf26

If you hear someone at .conf26 shouting "gear down, GEAR DOWN" across the show floor, you have found us.  The ...