Splunk Search

Different results when using bucket _time and timechart

rosho
Communicator

Hello
I want to count the number of logins by hour and then try to predict them.
I have tested 2 codes but I do not know why there is a difference in results.

This code gives me 741 results:

|index=fortigate
|bucket _time span=1h
|stats count by _time

This code gives me 744 results:

|index=fortigate
|timechart span=1h count(status) as logins

Thank you.

0 Karma
1 Solution

jnudell_2
Builder

Hi @rosho ,

The stats version will discard time range buckets where the count is 0. Timechart will include these timeranges (and therefore the result count will be different). Additionally in your timechart command you're putting in a count of statuses and setting it to logins. You're not doing the same thing for the stats command.

View solution in original post

jnudell_2
Builder

Hi @rosho ,

The stats version will discard time range buckets where the count is 0. Timechart will include these timeranges (and therefore the result count will be different). Additionally in your timechart command you're putting in a count of statuses and setting it to logins. You're not doing the same thing for the stats command.

Get Updates on the Splunk Community!

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...

Tech Talk | Elevating Digital Service Excellence: The Synergy of Splunk RUM & APM

Elevating Digital Service Excellence: The Synergy of Real User Monitoring and Application Performance ...

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...