Splunk Search

Different results when using bucket _time and timechart


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:

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

This code gives me 744 results:

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

Thank you.

0 Karma

Re: Different results when using bucket _time and timechart


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