Splunk Search

How to combine a csv and savedsearch and retrieve matching and unmatching results ?

kavyamohan
Explorer

I have a savedsearch which is a result of json data. Similarly I have a master csv. I have Assettag field common in both savedsearch and csv. Now, I want to combine both json and csv and get matching and unmatching results from both and also if Assettag is available in savedsearch but not in csv then it should be given Validation as Newly Scanned and if Assettag is available in csv but not in savedsearch then the Validation is Unscanned and if Assettag is available in both then it is Scanned. where Validation is a new field which should be created. How can I do this? 

0 Karma
1 Solution

thambisetty
SplunkTrust
SplunkTrust

you can modify as you need. but below is the procedure to get results what you are expecting.

| your search # here, you have got search results from saved search and result has field called tag assuming.
| eval source="savedsearch"
| append [ | inputlookup yourcsvlookup.csv | table tag | eval source="lookup"]
| stats dc(source) as dc_source values(*) as * by tag
| eval validation=case(source=="savedsearch" AND dc_source=="1","Newly scanned",source=="lookup" AND dc_source=="1","Unscanned",dc_source=="2","scanned",1=1,"Other")

 

————————————
If this helps, give a like below.

View solution in original post

thambisetty
SplunkTrust
SplunkTrust

you can modify as you need. but below is the procedure to get results what you are expecting.

| your search # here, you have got search results from saved search and result has field called tag assuming.
| eval source="savedsearch"
| append [ | inputlookup yourcsvlookup.csv | table tag | eval source="lookup"]
| stats dc(source) as dc_source values(*) as * by tag
| eval validation=case(source=="savedsearch" AND dc_source=="1","Newly scanned",source=="lookup" AND dc_source=="1","Unscanned",dc_source=="2","scanned",1=1,"Other")

 

————————————
If this helps, give a like below.
Get Updates on the Splunk Community!

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 ...

Wrapping Up Cybersecurity Awareness Month

October might be wrapping up, but for Splunk Education, cybersecurity awareness never goes out of season. ...

🌟 From Audit Chaos to Clarity: Welcoming Audit Trail v2

🗣 You Spoke, We Listened  Audit Trail v2 wasn’t written in isolation—it was shaped by your voices.  In ...