Using mvrange with time! I think you also gave me this a long time ago for a different question, but with a unit instead of directly with _time. (mvexpand with info_max_time - info_min_time is too m...
See more...
Using mvrange with time! I think you also gave me this a long time ago for a different question, but with a unit instead of directly with _time. (mvexpand with info_max_time - info_min_time is too much.) Combining that lesson (thanks again!) and this formula, and working out some Splunk kinks, I can make it work with simple count. To start, I also realize that addinfo in makeresults will not work the same way as in a search command. So, I modified my simulation strategy a little. This will be my new baseline: index = _internal
| where _time < relative_time(now(), "-2h@h") ``` simulate zero-count buckets ```
| timechart span=1h count The complete workaround will be index = _internal
| where _time < relative_time(now(), "-2h@h") ``` simulate zero-count buckets ```
| bucket _time span=1h@h
| chart count over _time
| append
[| makeresults | addinfo
| eval hours = mvrange(0, round((info_max_time - info_min_time) / 3600))
| eval time = mvmap(hours, info_min_time + hours * 3600)
| table time | mvexpand time
| rename time as _time
| bucket _time span=1h@h
| eval count=0]
| stats sum(count) as count by _time Then, I should have noted in OP that my chart has a groupby clause. So, I move my baseline to index = _internal sourcetype IN (splunkd, splunkd_access, splunkd_ui_access)
| where _time < relative_time(now(), "-2h@h") ``` simulate zero-count buckets ```
| timechart span=1h count by sourcetype The workaround with groupby therefore is index = _internal sourcetype IN (splunkd, splunkd_access, splunkd_ui_access) ``` simulate zero-count buckets ```
| where _time < relative_time(now(), "-2h@h")
| bucket _time span=1h@h
| chart count over _time by sourcetype
| append
[| makeresults | addinfo
| eval hours = mvrange(0, round((info_max_time - info_min_time) / 3600))
| eval time = mvmap(hours, info_min_time + hours * 3600)
| table time | mvexpand time
| rename time as _time
| bucket _time span=1h@h
| foreach splunkd, splunkd_access, splunkd_ui_access
[eval <<FIELD>> = 0]]
| chart sum(*) as * by _time This is super messy; it can be daunting if there are many values in groupby, or if values are unpredictable. As you said, I should try to stick to timechart when dealing with time series.