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!

Building Reliable Asset and Identity Frameworks in Splunk ES

 Accurate asset and identity resolution is the backbone of security operations. Without it, alerts are ...

Cloud Monitoring Console - Unlocking Greater Visibility in SVC Usage Reporting

For Splunk Cloud customers, understanding and optimizing Splunk Virtual Compute (SVC) usage and resource ...

Automatic Discovery Part 3: Practical Use Cases

If you’ve enabled Automatic Discovery in your install of the Splunk Distribution of the OpenTelemetry ...