Splunk Search

Splunk Filter from Lookup

Thulasinathan_M
Contributor

Hi Splunk Experts,
I've a lookup with field 'User', 'Rates' and 'Priority' (values 1 to 5). I use this lookup in my search, I wish to accomplish below Use cases. Kindly advice if it's possible.

Cases:
Lookup Priority value is '5', I've to get the max(Rates) from Priority Values 1 to 5.
Lookup Priority value is '4', I've to get the max(Rates) from Priority Values 1 to 4.
Lookup Priority value is '3', I've to get the max(Rates) from Priority Values 1 to 3.
Lookup Priority value is '1', I've to get the max(Rates) from Priority Values 1.

Labels (1)
Tags (1)
0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @Thulasinathan_M ,

please try this:

| inputlookup your_lookup.csv
| stats 
     max((eval(Priority=*, Rate, 0))) AS Rate_5
     max((eval(Priority<5, Rate, 0))) AS Rate_4
     max((eval(Priority<4, Rate, 0))) AS Rate_3
     max((eval(Priority<2, Rate, 0))) AS Rate_1
     BY User

Ciao.

Giuseppe

0 Karma

Thulasinathan_M
Contributor

Thanks @gcusello,
But this will create a multiple fields, but I wish to have this in a single field and results duplicated as each entity. So it'll be easy for me to use lookup join

Example Dataset:

USERRatePriority
UX1011.42
UX1012.34
UX3424.65
UX5157.31
UX5152.13

 

Expecting Output:

USERRatePriority
UX1011.41
UX1011.42
UX1012.33
UX1012.34
UX1012.35
UX3424.61
UX3424.62
UX3424.63
UX3424.64
UX3424.65
UX5157.31
UX5157.32
UX5157.33
UX5157.34
UX5157.35
0 Karma
Get Updates on the Splunk Community!

Splunk Observability for AI

Don’t miss out on an exciting Tech Talk on Splunk Observability for AI!Discover how Splunk’s agentic AI ...

Splunk Enterprise Security 8.x: The Essential Upgrade for Threat Detection, ...

Watch On Demand the Tech Talk, and empower your SOC to reach new heights! Duration: 1 hour  Prepare to ...

Splunk Observability as Code: From Zero to Dashboard

For the details on what Self-Service Observability and Observability as Code is, we have some awesome content ...