Splunk Search

How to create a search to combine inputlookup and search?

doniv
Loves-to-Learn Lots

Hi,

I want to compare the count of calls obtained in a day with the target in lookup csv,

for example:

input csv:

header: label hr1, hr2,hr3,......hr24

row1: LA, 1,2,1,5.....6

search: date hour:

index=foo | stats count by Label date hour

output: LA, 0,0,0,...5

 

Expected output:

  count(from lookup file) count(from search) Passed
LA 1 1 pass
OA 2 1 fail

Can someone me in writing the code combining search and input lookup?

 

Labels (2)
0 Karma

doniv
Loves-to-Learn Lots

| lookup lookup.csv Label Hour is not showing any results...am i missing anything?

But |inpulookup lokup.csv display the content of csv

 

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Possibly field name mismatches? (Fieldnames are case-sensitive)

Possibly field contents mismatch? (Lookups are usually set up as exact matches)

0 Karma

doniv
Loves-to-Learn Lots

I can manage to bring it for hourly basic, if i can able to do it for aggregated way..

Count of LA in inputlookup is 1 it should match with the search else it is fail

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

This is still not clear what you are trying to do

If you can change your lookup so it is like this:

LabelHourLookupCount
LA11
LA23
etc.  

Then you can do

| stats count by Label Hour
| lookup lookup.csv Label Hour
| eval Passed=if(count==LookupCount,"pass","fail")
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Your expected output no longer has date or hour - is the hour no longer important?

Your csv appears to have columns for label and each hour but your search stats command will return columns with label, date, hour and count - are you able to rework your csv so it matches your search?

0 Karma

doniv
Loves-to-Learn Lots

I will work on the recommends suggested today and let you know

0 Karma
Get Updates on the Splunk Community!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...