Splunk Search

Creating Exclusion list FILE for excluding Ip addresses

EdSplunk
Explorer

I'm trying to find all firewall denied and passing a stats command to it, but I have a list of ip's that it should be excluded in the stats.

deny AND NOT [excluded src ip list in here] | stats count by src | search count > 2

The requirement would be that the exclusion list be in a file that I could just put the search to avoid having to write excessively on the search box.

Tags (1)
0 Karma
1 Solution

gkanapathy
Splunk Employee
Splunk Employee

Yes, you can make a lookup file. If you had a file with:

ip, optionalotherfield1, anotherfield
1.1.2.3, x ,y
3.4.6.7, abc,def
5.6.7.8, 123,444

defined as a lookup file called excludedip.csv, you would just do:

deny AND NOT [ inputlookup excludedips.csv | fields ip ] | stats count by src

You can refine this by giving the csv file a logical name in Splunk, and you can also use outputlookup in jobs to generate the contents of the csv file from other data.

View solution in original post

gkanapathy
Splunk Employee
Splunk Employee

Yes, you can make a lookup file. If you had a file with:

ip, optionalotherfield1, anotherfield
1.1.2.3, x ,y
3.4.6.7, abc,def
5.6.7.8, 123,444

defined as a lookup file called excludedip.csv, you would just do:

deny AND NOT [ inputlookup excludedips.csv | fields ip ] | stats count by src

You can refine this by giving the csv file a logical name in Splunk, and you can also use outputlookup in jobs to generate the contents of the csv file from other data.

EdSplunk
Explorer

perfect, thanks!

0 Karma

netwrkr
Communicator

Yes, it can be done. Using the example

10.0.0.1 iptables: deny: IN= OUT=eth0 SRC=1.1.1.1 DST=2.2.2.2 LEN=89 TOS=0x00 PREC=0x00 TTL=64 ID=6102 DF PROTO=TCP SPT=443 DPT=52483 WINDOW=248 RES=0x00 ACK PSH FIN URGP=0 

deny NOT SRC=1.1.1.1 NOT SRC=x.x.x.x NOT SRC=x.x.x.x etc etc

netwrkr
Communicator

why not make it an eventtype?

0 Karma

EdSplunk
Explorer

Thanks, can these "NOT"s be in a file instead of in the search? I also updated the question. Sorry about not supplying this requirement earlier.

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

SOK it to Me: Top 3 Benefits of Using Splunk Operator on Kubernetes that’ll Make ...

    Thursday, July 9, 2026  |  11:00AM–12:00PM PDT Duration: 1 hour (includes Q&A) Managing can feel like a ...

Upgrade Prep for 10.4, Network Observability Deep Dives, and More from Splunk Lantern

Splunk Lantern is Splunk’s customer success center that provides practical guidance from Splunk experts on key ...

Splunk Developer Day announcements: AI agents, MCP tools, Forecasting, and Custom ...

Splunk Developer Day was packed with product and platform updates for developers building in the AI ...