Splunk Search

How to write query to exclude the logs having src_ip starting with either 10 or 172?

biswa2112
Engager

I have this query in Splunk which gets me the src_ip  along with different fields  for the particular UserId. But i want to exclude the logs having src_ip starting with either 10 or 172 . Could someone please help  

 

index=wineventlog $UserId sourcetype="WinEvt:ADFS" EventCode=120* | rex "IpAddress\W(?<src_ip>\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3})" | rex "Activity\sID\W(?<Activity_ID>\s.*)" | table src_ip, Activity_ID, _time, UserAgent | sort _time | reverse

Labels (3)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust
index=wineventlog $UserId sourcetype="WinEvt:ADFS" EventCode=120* 
| rex "IpAddress\W(?<src_ip>\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3})" 
| regex src_ip!="^10\.|^172\."
| rex "Activity\sID\W(?<Activity_ID>\s.*)" 
| table src_ip, Activity_ID, _time, UserAgent 
| sort 0 - _time

View solution in original post

ITWhisperer
SplunkTrust
SplunkTrust
index=wineventlog $UserId sourcetype="WinEvt:ADFS" EventCode=120* 
| rex "IpAddress\W(?<src_ip>\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3})" 
| regex src_ip!="^10\.|^172\."
| rex "Activity\sID\W(?<Activity_ID>\s.*)" 
| table src_ip, Activity_ID, _time, UserAgent 
| sort 0 - _time
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 ...