Splunk Search

Using both "top" and "lookup" commands together

RMartinezDTV
Path Finder

Hi, I have a search where I'm attempting to use a lookup table and the top command in the same search.

The search is in the following format:

my_data | top actChar | lookup action_list actType,actChar OUTPUT act_desc | table actChar, actType, act_desc, count, percent

I'd like to get the statistics given by top (count and percent) but also include a detailed description of the action (stored in the lookup table as act_desc). I can successfully get either of those values, but cannot seem to get both the description and count/percent.

Removing the top command, the lookup works correctly (also works in other searches)...there is some issue with how I am crafting my search. I have tried moving the components of the search in every combination I can think of to no avail.

What is the right way to use lookup and top together?

Tags (3)
0 Karma
1 Solution

Ayn
Legend

The problem is that once you've done top actChar, the top command will only emit a few fields - namely, actChar, count and percent. So, the actType field you're trying to use in your lookup isn't available which means that your lookup will fail.

If actType and actChar always correspond to each other you could just do

my_data | top actChar,actType | ...

View solution in original post

Ayn
Legend

The problem is that once you've done top actChar, the top command will only emit a few fields - namely, actChar, count and percent. So, the actType field you're trying to use in your lookup isn't available which means that your lookup will fail.

If actType and actChar always correspond to each other you could just do

my_data | top actChar,actType | ...

RMartinezDTV
Path Finder

That was it - thank you.

I guess this is another case of limiting data too early on...I compared this with my other working report: the difference is that one uses stats which isn't reducing the available fields in the same way as the top command does here.

0 Karma
Get Updates on the Splunk Community!

Accelerate Service Onboarding, Decomposition, Troubleshooting - and more with ITSI’s ...

Accelerate Service Onboarding, Decomposition, Troubleshooting - and more! Faster Time to ValueManaging and ...

New Release | Splunk Enterprise 9.3

Hi Splunky people! We are excited to share the newest updates in Splunk Enterprise 9.3!Admins and Analyst can ...

2024 Splunk Career Impact Survey | Earn a $20 gift card for participating!

Hear ye, hear ye! The time has come again for Splunk's annual Career Impact Survey!  We need your help by ...