Splunk Search

How to take output from a lookup and feed it to another lookup and append the results?

Glasses
Builder

Hi,

Let's say I have a Company directory lookup (e.g. Company_Directory) and I want to lookup the entire hierarchy of supervisors for a specific employee.

For instance>>>

Alice reports to Bob, then take Bob as new lookup criteria...

Bob reports to Cathy, etc....  

and append this all  in a chain of command >>> Alice, Bob, Cathy, Donna, Eric, Fred.... etc

Does Splunk have a command/capability to take the results as feed back to a lookup loop?

Thank you

Labels (1)
0 Karma
1 Solution

PickleRick
SplunkTrust
SplunkTrust

SPL is not an imperative programming language so apart from some exceptions like foreach it doesn't understand concepts of "loop" and such.

Also, even though you may perform an inputlookup, modify it and outputlookup it at the end, it will only update the contents of the lookup. That lookup won't be processed back again by the same search pipeline. It might get processed by subsequent run (for example if it's a scheduled report).

 

View solution in original post

0 Karma

PickleRick
SplunkTrust
SplunkTrust

SPL is not an imperative programming language so apart from some exceptions like foreach it doesn't understand concepts of "loop" and such.

Also, even though you may perform an inputlookup, modify it and outputlookup it at the end, it will only update the contents of the lookup. That lookup won't be processed back again by the same search pipeline. It might get processed by subsequent run (for example if it's a scheduled report).

 

0 Karma

Glasses
Builder

Thanks, I didn't really think it was possible to do a loop, but had to ask... 

0 Karma

PickleRick
SplunkTrust
SplunkTrust

There are tricks to do a bit of imperative-like programming (there was a presentation on it on one of previous .confs) but it's more of a proof-of-concept that it's possible - it's not very practical, not very readable and not very efficient. And of course scope of usability is very very limited.

So it's safe to assume that you can't do such things in general.

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!

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

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

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 ...