Splunk Search

How to write a search to graph the duration scripts ran using "begin" and "finished" time fields?

alanxu
Communicator

Right now I have two different scripts: report scripts and procedure scripts. They have a begin and finished time. I am trying to create a graph using the time as the y-axis and the report as the x-axis and the procedure as x-axis on another graph. Example text would be...

2012-03-22 00:7:02,318 INFORMATION Begin Procedure Script
2012-03-22 00:8:02,318 INFORMATION FINISHED Procedure Script (0)
0 Karma
1 Solution

woodcock
Esteemed Legend

Your question is too vague but this should get you started:

... | rex "^\W+\w+\W+\w+(?<Report>\W+)\w+(?<BeginOrFinished>\W+)\w+(?<Procedure>.*)$" | where BeginOrFinished="Begin" | timechart ...

View solution in original post

woodcock
Esteemed Legend

Your question is too vague but this should get you started:

... | rex "^\W+\w+\W+\w+(?<Report>\W+)\w+(?<BeginOrFinished>\W+)\w+(?<Procedure>.*)$" | where BeginOrFinished="Begin" | timechart ...

alanxu
Communicator

Is there anything I clarify? But thank you for answering.. I will check what those commands do.

0 Karma

woodcock
Esteemed Legend

What exactly are you trying to chart? I can guess but that is silly! Just for grins, here are a few guesses with answers:

To chart the number of jobs completed per Report per hour, do this:

 ... | rex "^\W+\w+\W+\w+(?<Report>\W+)\w+(?<BeginOrFinished>\W+)\w+(?<Procedure>.*)$" | timechart span=1h count(eval(BeginOrFinished="FINISHED")) AS CompletedJobCount by Report

To chart the number of jobs initiated per Procedure per minute, do this:

 ... | rex "^\W+\w+\W+\w+(?<Report>\W+)\w+(?<BeginOrFinished>\W+)\w+(?<Procedure>.*)$" | timechart span=1m count(eval(BeginOrFinished="Begin")) AS InitiatededJobCount by Procedure
0 Karma

woodcock
Esteemed Legend

I fixed a minor error (re-edited).

0 Karma
Get Updates on the Splunk Community!

Webinar Recap | Revolutionizing IT Operations: The Transformative Power of AI and ML ...

The Transformative Power of AI and ML in Enhancing Observability   In the realm of IT operations, the ...

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...