Getting Data In

How to exclude private ip address range based on the result of "rex max_match"

haiweichen
Explorer

I run this query to extract all IP address from the events. There are multi ip based on one event.

index=*
| rex max_match=0 field=_raw "(?<ipaddr>\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})"
| dedup ipaddr
| table _time, ipaddr

 

The result is as below,

Capture.PNG

My question is, how to exclude private IP from the the result? Thanks!

Labels (1)
0 Karma
1 Solution

haiweichen
Explorer

Thanks, mvfilter works for my case. 

View solution in original post

0 Karma

richgalloway
SplunkTrust
SplunkTrust

use the mvfilter function to remove unwanted values from a multi--value field.

| rex max_match=0 field=_raw "(?<ipaddr>\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})"
| eval ipaddr=mvdedup(mvfilter(match(ipaddr,"10\..*")))
| table _time, ipaddr

Also, use mvdedup instead of dedup on multi-value fields.

---
If this reply helps you, Karma would be appreciated.
0 Karma

haiweichen
Explorer

Thanks, mvfilter works for my case. 

0 Karma
Get Updates on the Splunk Community!

What’s New in Splunk Cloud Platform 9.1.2308?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2308! Analysts can ...

Index This | Why do they call it hyper text?

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

State of Splunk Careers 2023: Career Resilience and the Continued Value of Splunk

For the past three years, Splunk has partnered with Enterprise Strategy Group to conduct a survey that gauges ...