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
SplunkTrust
SplunkTrust

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
SplunkTrust
SplunkTrust

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!

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...

What’s New in Splunk Security Essentials 3.8.0?

Splunk Security Essentials (SSE) is an app that can amplify the power of your existing Splunk Cloud Platform, ...