Splunk Search

How do I chart by hour rather than date

bsteph
Explorer

I'm parsing a log file with the following command:
source="startjob.log" |eval stime=strptime(start_timestamp,"%y/%m/%d.%H:%M:%S") |eval etime=strptime(end_timestamp,"%y/%m/%d.%H:%M:%S") |eval duration= (etime-stime)|timechart avg(duration) by job_name span=1h

which gives me this result set:

"_time",NDM5911D,NTM5443C,NTM5870D,NTM6018D,NTM6225D,NTM6558D,NTM6825D,NTMA12UD,NTU7201D,NTU7370D,OTHER
"2012-08-12T00:00:00.000-0500",,,,,,,,,,,
"2012-08-13T00:00:00.000-0500",,,,,,"11127.000000",,"8541.000000",,,"124.187500"
"2012-08-14T00:00:00.000-0500",,,,,,,,,"16286.000000",,"233.280000"
"2012-08-15T00:00:00.000-0500","15134.000000",,,,,,,,,,"68.000000"
"2012-08-16T00:00:00.000-0500",,"8114.000000","10285.000000","15018.000000","9280.000000",,"9479.000000",,,"12600.000000","277.248609"
"2012-08-17T00:00:00.000-0500",,,,,,,,,,,
"2012-08-18T00:00:00.000-0500",,,,,,,,,,,
"2012-08-19T00:00:00.000-0500",,,,,,,,,,,

Date is the most granular chart it's allowing me, but I'd like to chart what jobs were running by hour and I'd also like to show the duration of the job. For example, I'd like to chart what jobs were running on a week, then drill down to what jobs were running during a certain day, then drill down to what jobs were running in a particular hour and for how long each job ran.

Any ideas?

Tags (1)
0 Karma

yannK
Splunk Employee
Splunk Employee

if you narrow to 1 day, try
| chart avg(duration) over date_hour by job_name
or
| chart avg(duration) over job_name by date_hour

yannK
Splunk Employee
Splunk Employee

did it worked for you ?

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Defend at Machine Speed: Your Guide to Security Sessions at .conf26

Splunk .conf26   With threats moving at machine speed and attack surfaces expanding across hybrid ...

Where Innovation Takes Flight: The Splunk4Aviation Flight Sim Lands at .conf26

If you hear someone at .conf26 shouting "gear down, GEAR DOWN" across the show floor, you have found us.  The ...

Turn Cisco Telemetry Into Action with Cisco Data Fabric, powered by the Splunk ...

The surge in machine data is already hitting enterprise budgets, and the agentic era will only intensify it. ...