Splunk Search

How to list out all the lookups and display count of records present in each lookup?

himanshu1
Loves-to-Learn Lots

Hi Friends,

 

I am trying to list out all the available splunk lookups and want to display count of records present in each lookups.

However i found rest command to list out all the lookups but how to get count of records for each lookup ?

Rest command : 

| rest/servicesNS/-/-/data/lookup-table-files |table title 

 I want to display count of records present in each lookup in another column. Is it possible to display with SPL?

Requesting your valuable feedback and help.

Thank you in advance.

Himanshu

 

 

Labels (1)
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

You could try something like this (although you may get some errors if your definitions aren't complete):

| rest/servicesNS/-/-/data/lookup-table-files
| table title
| map maxsearches=200 search="| inputlookup $title$ | eval title="$title$" | stats count by title"

Also, note you may have to adjust maxsearches depending on how many files you have. 

himanshu1
Loves-to-Learn Lots

Thank you so much for your valuable feedback.

Query is working fine but it gets terminated if it encounters any invalid lookup.

any workaround to fix this issue ?

Thank You, 

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Community Content Calendar, September edition

Welcome to another insightful post from our Community Content Calendar! We're thrilled to continue bringing ...

Splunkbase Unveils New App Listing Management Public Preview

Splunkbase Unveils New App Listing Management Public PreviewWe're thrilled to announce the public preview of ...

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...