Splunk Search

Using lookup tables and searching it twice

rmorlen
Splunk Employee
Splunk Employee

We have a user lookup table that contains information such as username, email, and managername. I can do a lookup to find a user's managername.

| inputlookup userlookup | search username="bob" | fields username, email, manager

From that I would like to get the email address for the manager. Something like:

| inputlookup userlookup | search username="bob"| fields manager | rename manager AS empManager | search [| inputlookup userlookup username=empManager]

Which doesn't work because the syntax is all screwed up (and I'm not good with lookup tables).

Tags (1)
0 Karma
1 Solution

sc0tt
Builder

I think something like this should work:

..search | fields username
| lookup userlookup username OUTPUT manager
| lookup userlookup username as manager OUTPUT emailaddress

Since you have the manager name in the lookup table, it may be a good idea to just include an additional field with the manager's email.

View solution in original post

sc0tt
Builder

I think something like this should work:

..search | fields username
| lookup userlookup username OUTPUT manager
| lookup userlookup username as manager OUTPUT emailaddress

Since you have the manager name in the lookup table, it may be a good idea to just include an additional field with the manager's email.

rmorlen
Splunk Employee
Splunk Employee

Thank you. That worked.

0 Karma
Get Updates on the Splunk Community!

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...