Splunk Search

Can you help me chart a statistics table on a month by month basis?

x213217
Explorer

Hello,

I have a search that generates a statistics table based on the timerange I select.

How can I select, lets say, a timerange of 1 year and have the statistics generated and displayed over each month? I want to avoid manually having to change the time range to select each month, view statistics, etc...

This is my search

index=autosys source=
| where status="SUCCESS"
| eval startTimeEpoch = strptime(startTime, "%Y-%m-%d %H:%M:%S")
| eval startTimeHour = strftime(startTimeEpoch, "%H") 
| eval endTimeEpoch = strptime(endTime, "%Y-%m-%d %H:%M:%S")
| eval endTimeHour = strftime(endTimeEpoch, "%H") 
| eventstats count(startTimeHour) AS startHourCount by startTimeHour
| eventstats count(endTimeHour) As endHourCount by endTimeHour
| eventstats count(jobName) As RunCount by jobName
| eval startHourPercent = ((startHourCount / RunCount) * 100)
| eval endHourPercent = ((endHourCount / RunCount) * 100)
| eval roundedStartHourPercent =round(startHourPercent)
| eval roundedEndHourPercent =round(endHourPercent)
| dedup startTimeHour endTimeHour
| sort -roundedStartHourPercent
| sort -roundedEndHourPercent
| table jobName startTimeHour endTimeHour 

alt text

Tags (2)
0 Karma

somesoni2
Revered Legend

YOu don't show any of the calculated fields in the final output, do you really need to do those calculations? What type of reporting you're trying to do?

0 Karma
Get Updates on the Splunk Community!

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...

Splunk APM: New Product Features + Community Office Hours Recap!

Howdy Splunk Community! Over the past few months, we’ve had a lot going on in the world of Splunk Application ...

Index This | Forward, I’m heavy; backward, I’m not. What am I?

April 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...