Splunk Search

How to calcualte the count diff between 2 searches?

jerrytao
New Member

index=A | stats count as count1
index=A | dedup field1 field2 | stats count as count2

This 2 searched have same index A, then I want to calculate (count1-count2).

Anyone can help on this? Thanks in advance!

Tags (2)
0 Karma
1 Solution

vnravikumar
Champion

Hi

Try this

index=A | stats count as count1
| appendcols 
    [| search index=A | dedup field1 field2 | stats count as count2] |eval diff = count1-count2

View solution in original post

0 Karma

vnravikumar
Champion

Hi

Try this

index=A | stats count as count1
| appendcols 
    [| search index=A | dedup field1 field2 | stats count as count2] |eval diff = count1-count2
0 Karma
Get Updates on the Splunk Community!

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

Let’s Get You Certified – Vegas-Style at .conf24

Are you ready to level up your Splunk game? Then, let’s get you certified live at .conf24 – our annual user ...