Splunk Search

searchmatch function

surekhasplunk
Communicator

Hi

I am trying to find an ip from first query and then search that ip if exists in another csv file and show the count of only those ips

| inputlookup asset_list.csv 
| search "Infrastrucure Name"="xyz" | eval main_ip=IP [| inputlookup ip_exist.csv  |  eval test=if(searchmatch("IP=$main_ip$"), "yes", "no") | table IP test | where test="yes" ]

But i am getting error in the eval function.
please help.

Tags (3)
0 Karma

renjith_nair
Legend

@surekhasplunk,

Try

 | inputlookup asset_list.csv |eval source="asset"
 | search "Infrastrucure Name"="xyz" |append [| inputlookup ip_exist.csv|eval source="exist" ]
 | stats count,values(source) as source by IP|where mvcount(source) > 1

If you have different field names for IP in the csv, rename one of them
If you have unique IPs in both files, stats ccount by IP|where count >1 also should work

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

Building Reliable Asset and Identity Frameworks in Splunk ES

 Accurate asset and identity resolution is the backbone of security operations. Without it, alerts are ...

Cloud Monitoring Console - Unlocking Greater Visibility in SVC Usage Reporting

For Splunk Cloud customers, understanding and optimizing Splunk Virtual Compute (SVC) usage and resource ...

Automatic Discovery Part 3: Practical Use Cases

If you’ve enabled Automatic Discovery in your install of the Splunk Distribution of the OpenTelemetry ...