Splunk Search

Comparing two different sources

Muthu_Vinith
Path Finder

Hi Experts, 

I need to compare server lists from two different csv lookups and create a flag based on the comparison results, 
I have two lookups

  • abc.csv - contains list of servers being monitored in dashboard

  • def.csv -contains list of servers from another source

 

  • I need to identify servers present in both abc.csv and def.csv
  • not found in dashboard (i.e abc.csv)
  • and not found in def.csv

How to compare it and create a flag? Any guidance or example queries would be greatly appreciated.
Thank You

Labels (3)
0 Karma

PickleRick
SplunkTrust
SplunkTrust

You should list and categorise them and then do a summarizing stats.

With a normal event search that could be done without appending but since you have the data in lookups you'd need to add a "lookup identifier field" to the lookup contents in order to avoid the append command. Assuming you don't have it, it's something like this:

| inputlookup abc.csv
| eval source=abc.csv
| table  server source
| append
  [ | inputlookup def.csv
     | eval source=def.csv
     | table server source ]

This wil, give you a set of your servers along with an identifier which lookup each server came from.

Now you can do

| stats values(source) as sources by server

And you'll get a multivalued field sources containing either of the source lookups or both of them sk you can use it to filter the data the way you want.

Alternative approach is to not add string labels but numerical ids (like 1 and 2) and then do sum() unstead of values() - then you'd have a field with value 1, 2 or 3 depending on which lookup the server was originally in.

One caveat to the initial building of the list - it uses the append command which has its limitations for run time (which will not be an issue here) and the number of returned results (which might). If you had the field I mentioned at the beginning identifying the lookup, instead of using the append command you could just use another inputlookup command with an append=t option.

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!

Index This | What travels the world but is also stuck in place?

April 2026 Edition  Hayyy Splunk Education Enthusiasts and the Eternally Curious!   We’re back with this ...

Discover New Use Cases: Unlock Greater Value from Your Existing Splunk Data

Realizing the full potential of your Splunk investment requires more than just understanding current usage; it ...

Continue Your Journey: Join Session 2 of the Data Management and Federation Bootcamp ...

As data volumes continue to grow and environments become more distributed, managing and optimizing data ...