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!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...