Splunk Search

How to search IP with wildcard?

mveca
New Member

I want to exclude both primary and secondary IP addresses from a search.

For example:

src_ip!=192.50.244.10 AND src_ip!=192.50.245.10

Can I combine the two by just using a wildcard in just one octet?

For example, something like:

src_ip!=192.50.24*.10
0 Karma
1 Solution

DavidHourani
Super Champion

Hi @mveca,

You could use a wildcard but that will match more than what you require since that also includes : 192.50.241.10,192.50.242.10 and others that you might want to keep.

If you really want to use a regex you could try something like what is shown here :
https://answers.splunk.com/answers/97697/exclude-regex-results-from-a-search.html

Your search would look like this :

yourbasesearch | regex src_ip!="192.50.24[4,5].10"

Let me know if that helps.

Cheers,
David

View solution in original post

0 Karma

VatsalJagani
SplunkTrust
SplunkTrust

@mveca - Yes you can do src_ip!=192.50.24*.10.

0 Karma

DavidHourani
Super Champion

this excludes 192.50.240.10,192.50.241.10....192.50.249.10 not just the primary IPs.

0 Karma

VatsalJagani
SplunkTrust
SplunkTrust

I think that's what @mveca wants, "not condition with wildcard".

0 Karma

DavidHourani
Super Champion

Hi @mveca,

You could use a wildcard but that will match more than what you require since that also includes : 192.50.241.10,192.50.242.10 and others that you might want to keep.

If you really want to use a regex you could try something like what is shown here :
https://answers.splunk.com/answers/97697/exclude-regex-results-from-a-search.html

Your search would look like this :

yourbasesearch | regex src_ip!="192.50.24[4,5].10"

Let me know if that helps.

Cheers,
David

0 Karma
Get Updates on the Splunk Community!

Buttercup Games Tutorial Extension - part 9

This series of blogs assumes you have already completed the Splunk Enterprise Search Tutorial as it uses the ...

Buttercup Games Tutorial Extension - part 8

This series of blogs assumes you have already completed the Splunk Enterprise Search Tutorial as it uses the ...

Introducing the Splunk Developer Program!

Hey Splunk community! We are excited to announce that Splunk is launching the Splunk Developer Program in ...