First Event
06:09:17:362 INFO com.x.y.ConnApp - Making a GET Request
Second Event
06:09:17:480 INFO com.a.b.Response - Output Status Code: 200
Now I want to calculate duration of these two events for every request. I went over the solutions on splunk and Stack Overflow, but still can't get the proper result.
The easy answer is the
transaction
command, although it has a couple of drawbacks. The first is the command can be a resource hog. The other is can be "greedy" in that multiple requests might be taken to be a single transaction. We'll take care of the second issue with themaxevents
option. There's not much we can do about the first except avoid usingtransaction
.Another option uses the
streamstats
command to calculate the difference between adjacent events. This should perform better thantransaction
.Both queries assume the start and end events for different requests are not intermingled.