Splunk Search

calculate time statistics over an hour, but only find releated events that occur within one minute

systemsatpayzon
Path Finder

I am trying to calculate statistics for when a transaction enters our application, and when the reply is sent from the application. I would like to calculate statistics over an hour and there are two key values that i use to find the events to caculate on (research and Locsite). Here is the query:

      sourcetype="Filter" transactionType=A44 | stats min(_time) AS earliest max(_time) AS latest by research,Locsite | eval duration=latest-earliest

this query returns the duration of the transaction. this query is good enough most of the time but sometimes events with the same "research" and "Locsite" is returned more than two times within the time range of an hour, then the duration value will be calculated over too long time. So i would like my query to only look for events with the same "Locsite" and "research" within one minute, but calculate statistics over the whole timerange

Tags (3)
0 Karma

systemsatpayzon
Path Finder

I solved it myself!

sourcetype="Filter" a44 | transaction research maxevents=2 |stats min(duration) max(duration) avg(duration) median(duration) perc95(duration)
0 Karma

aholzer
Motivator

Sound like a good use case for the "transaction" command. Here's some documentation to get you started:
http://docs.splunk.com/Documentation/Splunk/5.0.3/Knowledge/Searchfortransactions
http://docs.splunk.com/Documentation/Splunk/5.0.3/SearchReference/Transaction

Make sure to take careful note of maxspan and maxpause options.

Hope this helps!

systemsatpayzon
Path Finder

A better alternative would be to find consecutive occurences of the same value for the keys "research" and "Locsite" (request and response)

0 Karma
Get Updates on the Splunk Community!

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer at Splunk .conf24 ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

Splunk Lantern is Splunk’s customer success center that provides advice from Splunk experts on valuable data ...

Combine Multiline Logs into a Single Event with SOCK: a Step-by-Step Guide for ...

Combine multiline logs into a single event with SOCK - a step-by-step guide for newbies Olga Malita The ...