I have a script which sends individual events into Splunk, each event is essentially a report on a HTTP Request, either GET or POST. The event contains a number of fields but two key ones are StepName and Timing:
I'm writing a report which shows the average time taken for each step over last 15 minutes. However, from an end users point of view, some steps are part of one process e.g.
In this case Step2 and Step3 would be one process for an end user, therefore I'd like to be able to report on these as if they were one step so the following:
GetLoginPage 50
PostLoginPage 100
ProcessUserDetails 250
GetHomePage 80
would become
GetLoginPage 50
PostLoginPage 350
GetHomePage 80
I can use a replace on the StepName so I have
GetLoginPage 50
PostLoginPage 100
PostLoginPage 250
GetHomePage 80
How can I then merge these results so it summates the two PostLoginPage steps and then gives me an average over the time period for the three individual steps?
Note each step has a field called TransactionGUID which associates a group of steps for the same execution.
Hello,
your_search | replace "ProcessUserDetails" with "PostLoginPage" in StepName | chart sum(exec_time) over TransactionGUID by StepName | stats avg(GetLoginPage) avg(PostLoginPage) avg(GetHomePage)
is one way to do it. exec_time
would be the field where the execution time is stored.
Hope this helps,
Kristian
Hello,
your_search | replace "ProcessUserDetails" with "PostLoginPage" in StepName | chart sum(exec_time) over TransactionGUID by StepName | stats avg(GetLoginPage) avg(PostLoginPage) avg(GetHomePage)
is one way to do it. exec_time
would be the field where the execution time is stored.
Hope this helps,
Kristian
Thanks, I have found a way to do it not too disimilar to this so thanks for feedback.
I would suggest searching the documentation for eval(case). I had a similar issue and this was a suitable workaround. If you need any more help, let me know 🙂
Thanks, I was able to use the eval for this purpose and work into a solution
so.. eval StepName = case(HTTPRequest="GetLoginPage","GetLoginPage",(HTTPRequest="PostLoginPage" and HTTPRequest="ProcessUserDetails"),"PostLoginPage",HTTPRequest="GetHomePage","GetHomePage")
so it's case(name of fields you wish to rename/combine,"new name",name of fields you wish to rename/combine,"new name".......)