Splunk Enterprise

How do I stats different events with the same by clause?

jip31
Motivator

hi

I stats events like this

But my distinct count is wrong because some events have the same site

How to agregate Pb1, Pb2 and Pb3 separatively by site and to have the sum of the site please?

 

 

| stats count(eval(cit >= 40)) as Pb1, count(eval(cit2 >= 15)) as Pb2, count(eval(cit3 >= 20)) as Pb3 by site 
| eval Total=Pb1 + Pb2 + Pb3 
| search Total > 10 
| stats dc(site)

 

 

 

 

Tags (1)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust
| eval Pb1=if(cit>=40,1,0)
| eval Pb2=if(cit2 >= 15,1,0)
| eval Pb3=if(cit3 >= 20,1,0)
| stats max(Pb1) as Pb1 max(Pb2) as Pb2 max(Pb3) as Pb3 by site
| stats sum(Pb1) as Pb1 sum(Pb2) as Pb2 sum(Pb3) as Pb3

View solution in original post

0 Karma

jip31
Motivator

I need to distinct count the number of site returnd by cit1, cit2 and cit3

that why I do a stats by site

The problem is that cit1 for example can have the same list of site than cit2

So my need is to distinct count the number of site separatively for cit1, cit2 and cit3 and after this to do a distinct count of these site

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust
| eval Pb1=if(cit>=40,1,0)
| eval Pb2=if(cit2 >= 15,1,0)
| eval Pb3=if(cit3 >= 20,1,0)
| stats max(Pb1) as Pb1 max(Pb2) as Pb2 max(Pb3) as Pb3 by site
| stats sum(Pb1) as Pb1 sum(Pb2) as Pb2 sum(Pb3) as Pb3
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

It is not clear why this is not giving you what you want. Can you provide an example of the expected result and the events used to get this result?

0 Karma
Get Updates on the Splunk Community!

Splunk Mobile: Your Brand-New Home Screen

Meet Your New Mobile Hub  Hello Splunk Community!  Staying connected to your data—no matter where you are—is ...

Introducing Value Insights (Beta): Understand the Business Impact your organization ...

Real progress on your strategic priorities starts with knowing the business outcomes your teams are delivering ...

Enterprise Security (ES) Essentials 8.3 is Now GA — Smarter Detections, Faster ...

As of today, Enterprise Security (ES) Essentials 8.3 is now generally available, helping SOC teams simplify ...