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
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...

Modernize your Splunk Apps – Introducing Python 3.13 in Splunk

We are excited to announce that the upcoming releases of Splunk Enterprise 10.2.x and Splunk Cloud Platform ...

Step into “Hunt the Insider: An Splunk ES Premier Mystery” to catch a cybercriminal ...

After a whole week of being on call, you fell asleep on your keyboard, and you hit a sequence of buttons that ...