Splunk Search

Compare last hour values with previous day values (during that same hour).

nocostk
Communicator

Currently I've got a report that runs and compares the download time values for the last hour and the same hour in the previous day:

Page       Response Previous Day
Cart       0.15     0.13    
Homepage   0.14  0.17       
Nav     0.26     0.27       
Product 0.37     0.32       

I've got a query easy enough that will give me the current time - but I'm not sure how to get yesterdays during the same hour.

Here is my query:

index=omg test_name="Base Homepage" OR test_name="Base Storepage - Furniture" OR test_name="Base Product page - Memory Foam" OR test_name="Base Navigation page - Rugs" OR test_name="Base Cart Page" entry_type="Overall" | chart avg(response_time) as Response by test_name | eval Response=Response/1000 | eval Response=round(Response,2) | rename test_name as Page

Which returns in Splunk:

Page                               Response
Base Cart Page                    0.13
Base Homepage                      0.14
Base Navigation page - Rugs      0.24
Base Product page - Memory Foam     0.31
Base Storepage - Furniture        0.32

How can I also query a specific hour from another day? I found one question/answer that kind of addressed this - but it was for dates today and yesterday (whole days).

Tags (1)
0 Karma
1 Solution

David
Splunk Employee
Splunk Employee

I would probably run the search this way:

index=omg earliest=-1h latest=now
   test_name="Base Homepage" OR 
   test_name="Base Storepage - Furniture" OR 
   test_name="Base Product page - Memory Foam" OR 
   test_name="Base Navigation page - Rugs" OR 
   test_name="Base Cart Page" entry_type="Overall" 
   | chart avg(response_time) as Response by test_name 
   | eval Response=Response/1000 
   | eval Response=round(Response,2) 
   | rename test_name as Page
   | join Page 
       [ search index=omg earliest=-24h latest=-23h
           test_name="Base Homepage" OR 
           test_name="Base Storepage - Furniture" OR 
           test_name="Base Product page - Memory Foam" OR 
           test_name="Base Navigation page - Rugs" OR 
           test_name="Base Cart Page" entry_type="Overall" 
           | chart avg(response_time) as Response by test_name 
           | eval Response=Response/1000 
           | eval Response=round(Response,2) 
           | rename test_name as Page
           | rename Response as "Previous Response"
       ]

There is quite possibly a more efficient way of running this, but given that they're two non-overlapping time windows, I'd imagine this would probably work.

View solution in original post

0 Karma

David
Splunk Employee
Splunk Employee

I would probably run the search this way:

index=omg earliest=-1h latest=now
   test_name="Base Homepage" OR 
   test_name="Base Storepage - Furniture" OR 
   test_name="Base Product page - Memory Foam" OR 
   test_name="Base Navigation page - Rugs" OR 
   test_name="Base Cart Page" entry_type="Overall" 
   | chart avg(response_time) as Response by test_name 
   | eval Response=Response/1000 
   | eval Response=round(Response,2) 
   | rename test_name as Page
   | join Page 
       [ search index=omg earliest=-24h latest=-23h
           test_name="Base Homepage" OR 
           test_name="Base Storepage - Furniture" OR 
           test_name="Base Product page - Memory Foam" OR 
           test_name="Base Navigation page - Rugs" OR 
           test_name="Base Cart Page" entry_type="Overall" 
           | chart avg(response_time) as Response by test_name 
           | eval Response=Response/1000 
           | eval Response=round(Response,2) 
           | rename test_name as Page
           | rename Response as "Previous Response"
       ]

There is quite possibly a more efficient way of running this, but given that they're two non-overlapping time windows, I'd imagine this would probably work.

0 Karma

nocostk
Communicator

That did it. Thanks!

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

[Puzzles] Solve, Learn, Repeat: Matching cron expressions

This puzzle (first published here) is based on matching timestamps to cron expressions.All the timestamps ...

Design, Compete, Win: Submit Your Best Splunk Dashboards for a .conf26 Pass

Hello Splunkers,  We’re excited to kick off a Splunk Dashboard contest! We know that dashboards are a primary ...

May 2026 Splunk Expert Sessions: Security & Observability

Level Up Your Operations: May 2026 Splunk Expert Sessions Whether you are refining your security posture or ...