Splunk Search

How to use map to calculate fields data separately for each entity?

amitrinx
Explorer

Hi,

I have a combination of consumer limits

e.g, A=1000 b=500 c=500 d=200 rest=100
So basically i want a list of all consumer who reached 80% limit. So i wrote a query for one consumer. how can i accommodate all other consumers with different limits. Should i write separate query for each consumer?


sourcetype="OS"
operation= "ABC"
consumer_src="A"
| search minutesago= 1
| stats count by consumer_src
| where count >= 0.8 * 1000

Labels (2)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust
sourcetype="OS"
operation= "ABC"
| search minutesago= 1
| stats count by consumer_src
| eval limit=case(consumer_src=="A", 1000, consumer_src=="b", 500, consumer_src=="c", 500, consumer_src=="d", 200, 1==1, 100)
| where count >= 0.8 * limit

View solution in original post

ITWhisperer
SplunkTrust
SplunkTrust
sourcetype="OS"
operation= "ABC"
| search minutesago= 1
| stats count by consumer_src
| eval limit=case(consumer_src=="A", 1000, consumer_src=="b", 500, consumer_src=="c", 500, consumer_src=="d", 200, 1==1, 100)
| where count >= 0.8 * limit
Get Updates on the Splunk Community!

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer Certification at ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

Splunk Lantern is Splunk’s customer success center that provides advice from Splunk experts on valuable data ...