Splunk Search

How can I combine these two searches of the count of field A and the count of field B?

dbcase
Motivator

Hi,

I have these two queries

This one gets the number of camera sessions

index=wholesale_app buildTarget=blah product=* analyticType=DynamicChoice Properties.index=2 Properties.args{}=CONNECTED  |stats count as camerasessions

This one gets the number of camera sessions that had a problem

index=wholesale_app DynamicChoice Properties.index=3 buildTarget=blah product=*|dedup clientSessionId|stats count as camerafailures

What I'd like to do is "combine" the two so I can get the percentage of camera sessions that had a problem from the total. (i.e. divide the result of query 2 by the result of query 1

I've tried several different things but no joy...

0 Karma
1 Solution

somesoni2
Revered Legend

Give this a try

index=wholesale_app product=* buildTarget=blah (analyticType=DynamicChoice Properties.index=2 Properties.args{}=CONNECTED ) OR (DynamicChoice Properties.index=3) |stats count as camerasessions dc(clientSessionId)  as camerafailures
| eval "CameraFailure%"=round(camerafailures*100/camerasessions,2)

View solution in original post

0 Karma

somesoni2
Revered Legend

Give this a try

index=wholesale_app product=* buildTarget=blah (analyticType=DynamicChoice Properties.index=2 Properties.args{}=CONNECTED ) OR (DynamicChoice Properties.index=3) |stats count as camerasessions dc(clientSessionId)  as camerafailures
| eval "CameraFailure%"=round(camerafailures*100/camerasessions,2)
0 Karma

dbcase
Motivator

Hi Somesoni2,

You know I hate you right? 🙂

Many thanks!!!! Works perfectly!

0 Karma
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, ...