Splunk Search

How to calculate the percentage of certain field occurence in the events ?

zacksoft_wf
Contributor

In my events, there is a field called "is_interactive"  which has value of either 0 or 1.
Now the thing is, not all of my events has the field "is_interactive" in them.
How to do I know, how much of of my events have this field in them ?

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

stats count(is_interactive)

| makeresults count=20 
| eval is_interactive=random()%2
| eval is_interactive=if(random()%2 == 0,null(),is_interactive)
``` the lines above generate some random dummy data ```
| stats count count(is_interactive) as interactive sum(is_interactive) as total

This show total count, those events where is_interactive is not null, and the sum of the is_interactive to show that some of the is_interactive values are zero

0 Karma
Get Updates on the Splunk Community!

Splunk Decoded: Service Maps vs Service Analyzer Tree View vs Flow Maps

It’s Monday morning, and your phone is buzzing with alert escalations – your customer-facing portal is running ...

What’s New in Splunk Observability – September 2025

What's NewWe are excited to announce the latest enhancements to Splunk Observability, designed to help ITOps ...

Fun with Regular Expression - multiples of nine

Fun with Regular Expression - multiples of nineThis challenge was first posted on Slack #regex channel ...