Getting Data In

Lookup: local_ip{ having fields threat_key, CIDR range, description}. I want to match ip from index=* to the column CIDR range of lookup where threat_key="abc". How we can do that

shaif95
New Member

Lookup: local_ip{ having fields threat_key, CIDR range, description}. I want to match ip from index=* to the column CIDR range of lookup where threat_key="abc". How we can do that

Tags (1)
0 Karma
1 Solution

whrg
Motivator

Hi! If I understand correctly, your lookup file (let's name it threats.csv) looks like this:

threat_key,cidr_range,description
abc,192.168.0.0/24,Threat A
...

First, you need to create a lookup definition. Go into Settings / Lookups / Lookup definitions. Create a new one and name it "threats_lookup". Select "File-based" and "threats.csv". Very important: Click on "Advanced options" and under "Match type" enter: CIDR(cidr_range).

Now you should be able to run your search as follows:

index=* ... | table local_ip,...
| eval threat_key="abc"
| lookup threats_lookup threat_key cidr_range AS local_ip OUTPUT description

View solution in original post

0 Karma

shaif95
New Member

Here threat_key need to be check in lookup table itself. Like threat_key coloumns can have many values such as
abc
xyz
but for the abc values only how can I compare from lookup.

0 Karma

whrg
Motivator

So when you run your base seach (index=...) you get events which have both the local_ip field as well as the threat_key field. The threat_key field can have different values and only for threat_key="abc" you want to do the lookup. Do I understand correctly?

0 Karma

whrg
Motivator

Hi! If I understand correctly, your lookup file (let's name it threats.csv) looks like this:

threat_key,cidr_range,description
abc,192.168.0.0/24,Threat A
...

First, you need to create a lookup definition. Go into Settings / Lookups / Lookup definitions. Create a new one and name it "threats_lookup". Select "File-based" and "threats.csv". Very important: Click on "Advanced options" and under "Match type" enter: CIDR(cidr_range).

Now you should be able to run your search as follows:

index=* ... | table local_ip,...
| eval threat_key="abc"
| lookup threats_lookup threat_key cidr_range AS local_ip OUTPUT description
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!

Observability Simplified: Combining User Experience, Application Performance & ...

Tech Talk Observability Simplified: Combining User Experience, Application Performance & Network ...

Event Series May & June: From Network Visibility to Service Intelligence

Unifying the Network: Moving from Alert Noise to Service Intelligence with Splunk ITSI In today’s hybrid ...

Global Splunk User Group Events: May + June 2026

Your Splunk Community Awaits: Discover Upcoming User Group Events Worldwide    Staying ahead in the fast-paced ...