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 ?

Labels (1)
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!

New in Observability - Improvements to Custom Metrics SLOs, Log Observer Connect & ...

The latest enhancements to the Splunk observability portfolio deliver improved SLO management accuracy, better ...

Improve Data Pipelines Using Splunk Data Management

  Register Now   This Tech Talk will explore the pipeline management offerings Edge Processor and Ingest ...

3-2-1 Go! How Fast Can You Debug Microservices with Observability Cloud?

Register Join this Tech Talk to learn how unique features like Service Centric Views, Tag Spotlight, and ...