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

Happy Splunking!
0 Karma
Get Updates on the Splunk Community!

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...