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 the End of Support for Splunk Add-on Builder Means for You

Hello Splunk Community! We want to share an important update regarding the future of the Splunk Add-on Builder ...

Solve, Learn, Repeat: New Puzzle Channel Now Live

Welcome to the Splunk Puzzle PlaygroundIf you are anything like me, you love to solve problems, and what ...

Building Reliable Asset and Identity Frameworks in Splunk ES

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