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!

Index This | What is broken 80% of the time by February?

December 2025 Edition   Hayyy Splunk Education Enthusiasts and the Eternally Curious!    We’re back with this ...

Unlock Faster Time-to-Value on Edge and Ingest Processor with New SPL2 Pipeline ...

Hello Splunk Community,   We're thrilled to share an exciting update that will help you manage your data more ...

Splunk MCP & Agentic AI: Machine Data Without Limits

Discover how the Splunk Model Context Protocol (MCP) Server can revolutionize the way your organization uses ...