Splunk Enterprise

How to count all events in a metric index?

robertlynch2020
Motivator

Hi

I have a metric index that has multiple metric coming into it.

I know i can run a command like this, but i have over 20 different types of metrics and they might change over time. I know i cant run count(*) as you have to specify.

 

 

| mstats count("mx.process.cpu.utilization") as count WHERE "index"="murex_metrics" span=10s | stats count

 

 

 

Then I tried, however, if the data is the same it will only give you a unique not a correct count. 

 

 

| mpreview index=murex_metrics | stats count

 

 

 

So is there any command that will give me the stats count of a metric index quickly?

 

Labels (1)
0 Karma
1 Solution

Siddharth
Path Finder

Use this | mstats count(_value) as total where metric_name = "*"  AND  Index = metric_index span=you_want 


To understand what is count(_value) will do please read this 

Syntax:
 count(_value) | <function>(_value) [AS <string>] WHERE metric_name=<metric_name>Description: Specify a basic count of the _value field or a function on the _value field. The _value field uses a specific format to store the numeric value of the metric. You can specify one or more functions. Y


https://docs.splunk.com/Documentation/Splunk/8.2.6/SearchReference/Mstats check the last line of this page they have given the example of what you are looking for

View solution in original post

0 Karma

Siddharth
Path Finder

Use this | mstats count(_value) as total where metric_name = "*"  AND  Index = metric_index span=you_want 


To understand what is count(_value) will do please read this 

Syntax:
 count(_value) | <function>(_value) [AS <string>] WHERE metric_name=<metric_name>Description: Specify a basic count of the _value field or a function on the _value field. The _value field uses a specific format to store the numeric value of the metric. You can specify one or more functions. Y


https://docs.splunk.com/Documentation/Splunk/8.2.6/SearchReference/Mstats check the last line of this page they have given the example of what you are looking for

0 Karma

robertlynch2020
Motivator

Hi

That worked

| mstats count(_value) as total where metric_name = "*" AND index = murex_metrics

Cheers

 

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

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