Splunk Search

IP Address

rahmania
Engager

Hi,

I want to find the IP address : 10.1.4.0 to 10.1.41.128 on Splunk Search.
Is there an efficient query than OR ? (index=sources_Ip (sources_ip="10.1.4.0" OR sources_ip="10.1.4.1" OR sources_ip="1.1.4.2" OR ...) )

Thanks

S.V

Tags (2)
0 Karma
1 Solution

richgalloway
SplunkTrust
SplunkTrust

You could use wildcards to simplify the query.

index=sources_Ip sources_ip="10.1.*"

Or perhaps you can use CIDRs.

index=sources_Ip | where (cidrmatch("10.1.4.0/24", sources_ip) OR cidrmatch("10.1.5.0/24", sources_ip) ...) | ...
---
If this reply helps you, Karma would be appreciated.

View solution in original post

richgalloway
SplunkTrust
SplunkTrust

You could use wildcards to simplify the query.

index=sources_Ip sources_ip="10.1.*"

Or perhaps you can use CIDRs.

index=sources_Ip | where (cidrmatch("10.1.4.0/24", sources_ip) OR cidrmatch("10.1.5.0/24", sources_ip) ...) | ...
---
If this reply helps you, Karma would be appreciated.

David
Splunk Employee
Splunk Employee

Just a note -- you can also run CIDR matches in the base search. E.g., index=sources_Ip sources_ip=10.1.4.0/24 OR sources_ip=10.1.5.0/24.

0 Karma
Get Updates on the Splunk Community!

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...

.conf24 | Personalize your .conf experience with Learning Paths!

Personalize your .conf24 Experience Learning paths allow you to level up your skill sets and dive deeper ...

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...