Splunk Search

How to pass calculate the latest row count in multiple lookups?

rajeshmetso
Engager

Hi All,

 

I have around 100+ lookups, which get updated daily from indexed data using macro and saved search. I want to find if any of these lookups are getting flushed and row count turns to "0".  I created a lookup with all the lookup names and tried to pass the output to another lookup command and pull the stats. But this is not working. 

Any suggestion to fullfil this requirement would be appreciated

Thanks

Rajesh

Labels (1)
Tags (1)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust

It can get a bit complicated, but you could try something like this (assuming you have a lookup file with the names of the lookups in a field called file):

| inputlookup lookups.csv
| map search="| inputlookup "$file$"| stats count|eval file=\""$file$"\""

 However, this can sometimes fail if you don't have a definition for the lookup, in which case, try it this way

| inputlookup lookups.csv
| map search="| makeresults | map search=\"| inputlookup "$file$"| stats count\"|eval file=\""$file$"\""

View solution in original post

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

It can get a bit complicated, but you could try something like this (assuming you have a lookup file with the names of the lookups in a field called file):

| inputlookup lookups.csv
| map search="| inputlookup "$file$"| stats count|eval file=\""$file$"\""

 However, this can sometimes fail if you don't have a definition for the lookup, in which case, try it this way

| inputlookup lookups.csv
| map search="| makeresults | map search=\"| inputlookup "$file$"| stats count\"|eval file=\""$file$"\""
0 Karma

rajeshmetso
Engager

@ITWhisperer 

Thank you for quick response. This sorted the issue, but am getting only 10 results and below warning.

The search result count (110) exceeds maximum (10), using max. To override it, set maxsearches appropriately.

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust
0 Karma

rajeshmetso
Engager

@ITWhisperer thank you it worked.

| inputlookup lookups.csv | map search="| makeresults | map search=\"| inputlookup "$file$"| stats count\"|eval file=\""$file$"\"" maxsearches=150

0 Karma
Get Updates on the Splunk Community!

Community Content Calendar, November Edition

Welcome to the November edition of our Community Spotlight! Each month, we dive into the Splunk Community to ...

October Community Champions: A Shoutout to Our Contributors!

As October comes to a close, we want to take a moment to celebrate the people who make the Splunk Community ...

Stay Connected: Your Guide to November Tech Talks, Office Hours, and Webinars!

What are Community Office Hours? Community Office Hours is an interactive 60-minute Zoom series where ...