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!

Introducing the 2024 SplunkTrust!

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

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...