This is a very interesting question and none of the answers actually get you to the full solution, where you find not only the top concurrency during the day, but when that occurred.
First you should note that the bin command simply flattens one field into "bins". For example, it turns seconds of the day into hours of the day. It alone cannot do the job here,it must be combined with concurrency to find the actual concurrency at any transition point in the time series (i.e., when a connection comes or goes).
Here's the first search, which will find the most recent occurrence of the top concurrency time of the day:
...
| eval duration = ReqTime/1000
| concurrency duration=duration
| bin span=dh _time as day
| dedup day sortby -concurrency
| eval when=_time
| timechart span=1d max(concurrency) as concurrency list(when) as when
| convert ctime(when)
Now your actual search is a bit trickier since we may have many points in the day of highest concurrency:
...
| eval duration = ReqTime/1000
| concurrency duration=duration
| bin span=1d _time as day
| eventstats max(concurrency) as max_concurrency by day
| eval when=if(concurrency==max_concurrency, _time, null())
| timechart span=1d max(concurrency) as concurrency list(when) as when
| convert ctime(when)
The general recipe here is:
Convert the duration to seconds.
Compute the level of concurrency at the start of every event.
Create a representation of the day of each request.
Either dedup to find the single highest concurrency point, or eventstats+eval to find the many highest equal concurrency points.
Use timechart to summarize the data by day.
Make the time of occurrence prettier.
Note that this technique can be used on splunk_access.log data using the following search:
index=_internal source=*/splunkd_access.log earliest=-24h@h
| eval duration = spent/1000
| concurrency duration=duration
| bin span=1h _time as hour
| eventstats max(concurrency) as max_concurrency by hour
| eval when=if(concurrency==max_concurrency, _time, null())
| timechart span=1h max(concurrency) as concurrency list(when) as when
| convert ctime(when)
... View more