Splunk Search

How can I exclude list of IPs?

danutmatei
Explorer

Hello,

I have a .csv with 2 columns: hostname and ip.

How can I exclude the IPs from that list ?

Tried something like this, but it doesn't work: src_ip="[|inputlookup ip_list.csv | fields ip]"

Labels (1)
0 Karma

richgalloway
SplunkTrust
SplunkTrust

The inputlookup subsearch will return a list of IPs in key=value format.  It'll look something like

(ip=1.2.3.4 OR ip=4.5.6.7 OR ip=10.11.12.13)

Taken literally, it's an include list - Splunk will return only events with those ip values.  Use NOT to make it an exclude list.

index=foo NOT [|inputlookup ip_list.csv | fields ip]

This assumes index foo has a field called "ip".  If it doesn't then the subsearch will need a rename command.

---
If this reply helps you, Karma would be appreciated.
0 Karma
Get Updates on the Splunk Community!

Detecting Remote Code Executions With the Splunk Threat Research Team

REGISTER NOWRemote code execution (RCE) vulnerabilities pose a significant risk to organizations. If ...

Observability | Use Synthetic Monitoring for Website Metadata Verification

If you are on Splunk Observability Cloud, you may already have Synthetic Monitoringin your observability ...

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 ...