Splunk Search

Bucket time span causing incorrect date entries

ohlafl
Communicator

I have the following query:

some query... | bucket _time span=1d | eval date=strftime(_time, "%b %d, %Y") | chart avg(value) as Value over date

Which is tethered to the following time span:

 <earliest>-$global_time$d@d</earliest>
 <latest>-1@d</latest>

Where global_time can be any integer representing a number of days.

The data that comes out is correct but the statistics (and therefor visualization) always show the first day of the current month as the first entry, if I search over let's say 40 days I get the following result:

1st July ... 28th July, 24th June, 25th June, 26th June, 29th June... until 40 posts has been filled. What is wrong here???

Weekends are not included as there is no output data for Value during those days.

Tags (4)
0 Karma
1 Solution

woodcock
Esteemed Legend

It is because your date field is being sorted alphabetically and "1" always comes first. Try this:

some query... | bucket _time span=1d | eval date=_time | fieldformat date=strftime(date, "%b %d, %Y") | chart avg(value) as Value over date

View solution in original post

woodcock
Esteemed Legend

It is because your date field is being sorted alphabetically and "1" always comes first. Try this:

some query... | bucket _time span=1d | eval date=_time | fieldformat date=strftime(date, "%b %d, %Y") | chart avg(value) as Value over date

ohlafl
Communicator

Thank you.

0 Karma
Get Updates on the Splunk Community!

Splunk + ThousandEyes: Correlate frontend, app, and network data to troubleshoot ...

 Are you tired of troubleshooting delays caused by siloed frontend, application, and network data? We've got a ...

Splunk Observability for AI

Don’t miss out on an exciting Tech Talk on Splunk Observability for AI!Discover how Splunk’s agentic AI ...

🔐 Trust at Every Hop: How mTLS in Splunk Enterprise 10.0 Makes Security Simpler

From Idea to Implementation: Why Splunk Built mTLS into Splunk Enterprise 10.0  mTLS wasn’t just a checkbox ...