Splunk Search

Query for comparing 2 different time periods

WeiMar
New Member

Hi together,
I try to compare the PERC90 response times of an application before and after a software release for the 50 most used actions.

Here's the query

index=myindex source=mysource 
| rex field=_raw "^(?:[^;\n]*;){4}\s+(?P<utc_tsl_tranid>\w+:\w+)"
| rex field=_raw "^.+\/(?P<ui_locend>\w+\.[a-z_-]+\.\w+\.\w+)"
| dedup utc_tsl_tranid
| stats sum(DURATION) as weight by ui_locend
| sort - weight | head 50

Is there a way I can compare 2 time periods (for example: first start 2024-08-10 end 2024-08-15, second start 2024-08-20 end 2024-08-25). 

Field ui_locend has to match and I like to compare PERC(90) of DURATION, which can be calculated with STATS-Command.

It's a tricky one, will appreciate every idea.


Labels (2)
0 Karma

WeiMar
New Member

That was quick, thank you!

I always struggle a little bit with the date formats. Which formats are accepted in den <periods>-fields or what do I have to do, that format yyyy-mm-dd (without time) is possible?

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Change the time period of your search to include both time periods e.g. (earliest=<start of first period> latest=<end of first period>) OR (earliest=<start of second period> latest=<end of second period>). Then evaluate which period the event falls into eval period=if(_time < end of first period, "first", "second"). Then add period to you by clause.

Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

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

Unlock What’s Next: The Splunk Cloud Platform at .conf25

In just a few days, Boston will be buzzing as the Splunk team and thousands of community members come together ...