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!

Your Guide to Splunk Digital Experience Monitoring

A flawless digital experience isn't just an advantage, it's key to customer loyalty and business success. But ...

Data Management Digest – November 2025

  Welcome to the inaugural edition of Data Management Digest! As your trusted partner in data innovation, the ...

Upcoming Webinar: Unmasking Insider Threats with Slunk Enterprise Security’s UEBA

Join us on Wed, Dec 10. at 10AM PST / 1PM EST for a live webinar and demo with Splunk experts! Discover how ...