Splunk Search

Search query required to lookup a csv file

ajayrejin
Explorer

Hi,

I need to check if the source address from the firewall logs is in private ip address range. How would i check using inputlookup and join commands.
Below is the query i am using , however no results come up

index=firewall log_subtype=vulnerability severity=informational | join src [ inputlookup PRIVATE_IP.csv ] | stats count by src

Tags (1)
0 Karma

DMohn
Motivator

Hi,

You don't have to use a join here, which is a very "costly" command. A simple subsearch does the trick as well:

  index=firewall log_subtype=vulnerability severity=informational | search [inputlookup PRIVATE_IP.csv]

Given that the lookup table contains only one field named "src" - otherwise you will have to restrict the return from the subsearch and / or rename the field.

0 Karma

ajayrejin
Explorer

Hi,

Thank you for that query.
I am using the below query and results i see is only public IP addresses, however result should show only private IPs. Am i doin something wrong? Please do correct me

index=frewall log_subtype="vulnerability" severity="informational" | join type=left src_ip [ inputlookup PRIVATE_IP.csv ] | stats count by src_ip

0 Karma

DMohn
Motivator

You don't have to use the join command. Have you tried using the query I stated above? If you add the count command, you should get exactly the result you want.

 index=firewall log_subtype="vulnerability" severity="informational" | search [ inputlookup PRIVATE_IP.csv ] | stats count by src_ip
0 Karma

renjith_nair
Legend

@ajayrejin,

Try this and lets know if it works.

index=firewall log_subtype=vulnerability severity=informational |eval flag=0
|append [inputlookup PRIVATE_IP.csv |eval flag=1]
|stats count , max(flag) as flag  by src

If the count is > 1 and flag=1 then its a private IP which is part of your lookup file.

---
What goes around comes around. If it helps, hit it with Karma 🙂
0 Karma
Get Updates on the Splunk Community!

Observe and Secure All Apps with Splunk

  Join Us for Our Next Tech Talk: Observe and Secure All Apps with SplunkAs organizations continue to innovate ...

What’s New & Next in Splunk SOAR

Security teams today are dealing with more alerts, more tools, and more pressure than ever.  Join us for an ...

Observability Unlocked: Kubernetes Monitoring with Splunk Observability Cloud

 Ready to master Kubernetes and cloud monitoring like the pros? Join Splunk’s Growth Engineering team for an ...