Splunk Search

Is it possible to do eval and lookups with makeresult?

Thulasinathan_M
Contributor

Is it possible for me to do a main search and based on the results from main search I find the fileName and want to use it in the inputlookup for a sub-search. I'm using this on dashboard as well, so doing it by map is waiting for inputs in dashboard and never getting populated.

Lookup with map:

 

index=main Events
| stats count, Events
| eval fileName= <filename>
| eval lookup="| inputlookup ".fileName
| map search="| makeresults | map search="$lookup$

 


My Current search query:

 

index=main Events
| stats count, Events
| eval fileName= <filename>
[| inputlookup [| makeresults 
                  | eval search=fileName 
                  | table search]] | stats count as known by Events
| fillnull known values=0
<remaining search>​

 

 

Labels (1)
Tags (1)
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

As I have told you before, fields from the outer search are not available to the subsearch because the subsearch is executed first.

Having said that, since you are using a dashboard, you may be able to use a base search, and set a token in the done handler of the base search, which you can then use in the panel search

Thulasinathan_M
Contributor

Hi @ITWhisperer , Thanks. Used Tokens and it done the trick.
I try to push these results to a summary index, and will keep on doing this only if the event is not already present in summary index but I want to maintain the count of this events as well. It seems impossible to maintain unique event in summary index and keep on updating the count of events. Could you kindly suggest a solution for this please.

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

You should check out my talk on Summary index idempotency

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

Tech Talk Recap | Mastering Threat Hunting

Mastering Threat HuntingDive into the world of threat hunting, exploring the key differences between ...

Observability for AI Applications: Troubleshooting Latency

If you’re working with proprietary company data, you’re probably going to have a locally hosted LLM or many ...

Splunk AI Assistant for SPL vs. ChatGPT: Which One is Better?

In the age of AI, every tool promises to make our lives easier. From summarizing content to writing code, ...