Reporting

Populating Lookup using saved search

akshatj2
Path Finder

Hi All,

I would like to populate a lookup using savedsearches but condition being the previous entry from the lookup should only be removed if the current search result returns some values. In case the search does not return any value. the lookup should not be changed.

Can anyone help me with the possible solution for the same.

0 Karma

nareshinsvu
Builder

Hope this works. Give a Try

First command:

|from datamodel:"blahblah"| table "your column" | outputlookup your_lookup.csv

Next command: appends only if it finds additional rows in the output

|from datamodel:"blahblah"| table "your column" | where NOT [|inputlookup your_lookup.csv ] | outputlookup your_lookup.csv append=true

0 Karma

akshatj2
Path Finder

We don't want to append the data to any of the old lookup, it should be a new lookup created when the search returns any results.

0 Karma

nareshinsvu
Builder

So, you can use a new name in your command? But this will create numerous lookup files and very hard for you to manage/housekeep. Mate - what is your exact requirement?

|from datamodel:"blahblah"| table "your column" | where NOT [|inputlookup your_lookup.csv ] | outputlookup your_NEW_lookup.csv

0 Karma

richgalloway
SplunkTrust
SplunkTrust

Do your search then read the existing lookup file using the append=true option. Deduplicate the results and write them back to the lookup file.

---
If this reply helps you, Karma would be appreciated.
0 Karma

akshatj2
Path Finder

No, it just search for the events and write it to lookup. We do not append data as it will become very huge with time going forward

0 Karma

richgalloway
SplunkTrust
SplunkTrust

Have a look at the create_empty and override_if_empty options of the outputlookup command to see if they satisfy your requirements.

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