Reporting

How to save Splunk search output as report then use it as dynamic lookup in the next search?

lisav2021
Explorer

Dear Experts:

I'm new to Splunk. I have a search output device lists with events number greater than 20 as a report, for example,

event_date      src                              events

2021-02-08device1102
2021-02-08device220

I need to have a new search to look into the event details on each of the device on the list to create final report and alerts if applicable. The report has to be dynamic as part of my search each time as scheduled task hourly, cannot be a static csv file as Lookup. Please advise strategies and code. Thank you. Lisa

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

richgalloway
SplunkTrust
SplunkTrust

Thanks to those details we can say you don't need a lookup file after all.  Use a subsearch to collect the device names for use in the main search.  Like this:

index=blue-es-win_ad EventCode=4625 src IN [search stuff | rename device as src | format ] 
---
If this reply helps you, Karma would be appreciated.

View solution in original post

richgalloway
SplunkTrust
SplunkTrust

Thanks to those details we can say you don't need a lookup file after all.  Use a subsearch to collect the device names for use in the main search.  Like this:

index=blue-es-win_ad EventCode=4625 src IN [search stuff | rename device as src | format ] 
---
If this reply helps you, Karma would be appreciated.

lisav2021
Explorer

Thank you for your help! It worked!

0 Karma

lisav2021
Explorer

Typo correction: index=blue-es-win_ad EventCode=4625 src IN inputlookup multi_user_failure_on_devices.csv

failed.

0 Karma

lisav2021
Explorer

Thank you. I use outputlookup multi_user_failure_on_devices.csv. How can I use another search to use the csv file?

index=blue-es-win_ad EventCode=4625 src IN inputlookup customers.csv

Failed. How do I reference the csv file result where src= device1, or device2 cases?

Looking forward to hearing form you. Thank you.

0 Karma

richgalloway
SplunkTrust
SplunkTrust

Have the first search save its output to a lookup file using the outputlookup command.  Then the second search can read that data using inputlookup.  You're using a lookup file, but the data still is dynamic.

There may be other methods, too (perhaps using a subsearch), but we'd need to know more about the searches to be sure.

---
If this reply helps you, Karma would be appreciated.
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!

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Unlock What’s Next: The Splunk Cloud Platform at .conf25

In just a few days, Boston will be buzzing as the Splunk team and thousands of community members come together ...