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!

Shape the Future of Splunk: Join the Product Research Lab!

Join the Splunk Product Research Lab and connect with us in the Slack channel #product-research-lab to get ...

Auto-Injector for Everything Else: Making OpenTelemetry Truly Universal

You might have seen Splunk’s recent announcement about donating the OpenTelemetry Injector to the ...

[Puzzles] Solve, Learn, Repeat: Character substitutions with Regular Expressions

This challenge was first posted on Slack #puzzles channelFor BORE at .conf23, we had a puzzle question which ...