Alerting

How do you compare two results?

btawiah
Explorer

I have a table(main table).csv with field location.

I have raw logs that includes field location

main table.csv
location_field
A
B
C

Raw logs 
location_field
A 
B

Please, I need help with a query that will check raw logs against main table and give a result of C missing

search result should return C

0 Karma
1 Solution

btawiah
Explorer

I got it done. Thanks
| inputlookup main_table.csv
| fields location
| eval count=0
| append
[ search index=someindex*
| fields location
| stats count BY location ]
| stats sum(count) AS missing by location
| where missing= 0

Whenever results return 0 that means those locations are not in main table

View solution in original post

0 Karma

btawiah
Explorer

I got it done. Thanks
| inputlookup main_table.csv
| fields location
| eval count=0
| append
[ search index=someindex*
| fields location
| stats count BY location ]
| stats sum(count) AS missing by location
| where missing= 0

Whenever results return 0 that means those locations are not in main table

0 Karma

Vijeta
Influencer

@btawiah-can you extract the filed that has location from your raw logs? If not then you will have to provide a log sample.
Once you extract the field say loc , the query can be something like this-

 |inputlookup maintable.csv| join type=outer location[search index=* | rename loc as location| fields source]| where ISNULL(source)
0 Karma

btawiah
Explorer

I got it done. Thanks
| inputlookup main_table.csv
| fields location
| eval count=0
| append
[ search index=someindex*
| fields location
| stats count BY location ]
| stats sum(count) by location
| where count= 0

Whenever results return 0 that means those locations are not in main table

0 Karma

btawiah
Explorer

@Vijeta i actually updated the question. I dont have to extract fields because that already exist. I only need to get the difference and output the one from raw logs since that is not in the main table location field.

0 Karma

Vijeta
Influencer

@btawiah Try running this query, write the name of your index instead of "yourindexname"

  |inputlookup maintable.csv| join type=outer location_field[search index="yourindexname"| fields source]| where ISNULL(source)
0 Karma
Get Updates on the Splunk Community!

Detecting Remote Code Executions With the Splunk Threat Research Team

REGISTER NOWRemote code execution (RCE) vulnerabilities pose a significant risk to organizations. If ...

Observability | Use Synthetic Monitoring for Website Metadata Verification

If you are on Splunk Observability Cloud, you may already have Synthetic Monitoringin your observability ...

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...