Splunk Search

metadata vs stats count

sloshburch
Splunk Employee
Splunk Employee

When running | metadata index=myindex type=sources, I see 301785788 for my totalCount for one of my sources (let's call it source1).

When running index=myindex source=source1 | stats count, I see 219717265 for my count.

Both searches are run for April 1st, 2014 (not today).

Why does metadata provide a different totalCount than stats count of the same sourcetype and index over the same historical time period on the same search head?

Running splunk 6.0.3.

Tags (2)
0 Karma
1 Solution

somesoni2
Revered Legend

The metadata search command is not time bound. As per documentation for metadata search command:-

The metadata command returns data about a specified index or distributed search peer. It returns information such as a list of the hosts, sources, or source types accumulated over time and when the first, last, and most recent event was seen for each value of the specified metadata type. ****It does not provide a snapshot of an index over a specific timeframe (such as last 7 days).****

So what | metadata index=myindex type=sources is showing, is for all time (always) and what index=myindex source=source1 | stats count is showing is just for your time period (April 1st, 2014), hence the difference.

View solution in original post

somesoni2
Revered Legend

The metadata search command is not time bound. As per documentation for metadata search command:-

The metadata command returns data about a specified index or distributed search peer. It returns information such as a list of the hosts, sources, or source types accumulated over time and when the first, last, and most recent event was seen for each value of the specified metadata type. ****It does not provide a snapshot of an index over a specific timeframe (such as last 7 days).****

So what | metadata index=myindex type=sources is showing, is for all time (always) and what index=myindex source=source1 | stats count is showing is just for your time period (April 1st, 2014), hence the difference.

sloshburch
Splunk Employee
Splunk Employee

Oh interesting. I clearly misunderstood the use of the time bounds on the search. Thanks for clarifying!

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Calling All Security Pros: Ready to Race Through Boston?

Hey Splunkers, .conf25 is heading to Boston and we’re kicking things off with something bold, competitive, and ...

Beyond Detection: How Splunk and Cisco Integrated Security Platforms Transform ...

Financial services organizations face an impossible equation: maintain 99.9% uptime for mission-critical ...

Customer success is front and center at .conf25

Hi Splunkers, If you are not able to be at .conf25 in person, you can still learn about all the latest news ...