Splunk Search

How to compare two time same time frames with different day's.

rchams
Explorer

How to compare the average value of the field in two different time frames i.e same time today with same time yesterday.

Compare the today time frame with yesterday's time frame.

Labels (1)
0 Karma

richgalloway
SplunkTrust
SplunkTrust
Depending on your query, you may be able to use the timewrap command.
---
If this reply helps you, Karma would be appreciated.
0 Karma

rchams
Explorer

If i use timewrap it gives the total day average like yesterday total average comparing with today time frame(example like last 60mins). I'm looking for the search to compare the average value in the same time frame like 1 pm to 1.30 pm today with 1 pm to 1.30 pm yesterday. 

 

my search is :

index=XXXX sourcetype=XXXXX esb_service="XXXXXX"  esb_environment=prod esb_event=esbRespBE 
| eval esb_backend_time=round(esb_backend_time/1000,2)
| bin _time span=15m
| stats max(esb_backend_time) as response_time by esb_service,_time
| eval response_time = round(response_time,2)

 

0 Karma

to4kawa
Ultra Champion

index=XXXX sourcetype=XXXXX esb_service="XXXXXX"  esb_environment=prod esb_event=esbRespBE 
| eval esb_backend_time=round(esb_backend_time/1000,2)
| bin _time span=15m
| stats max(esb_backend_time) as response_time by esb_service,_time
| eval response_time = round(response_time,2)

| eval date=if(strftime(now(),"%F")=strftime(_time,"%F"),"today","yesterday")

| eval _time=strftime(_time,"%T")

| xyseries _time date response_time

 

0 Karma

rchams
Explorer

@to4kawa  @Hi Thanks for the query.

It's comparing total day, i'm looking for specific time frame today with yesterday. The query which you provided gives the today all day time frame comparison with yesterday all day comparison, if i'm looking 1 hr window for today need to compare with same 1 hr time frame yesterday only. Only those results needs to be displayed. 

0 Karma

to4kawa
Ultra Champion

I didn't see any such requirement from the first question and your query.

and your query is span=15min

for 1 hour comparison, How are you going to aggregate 4 values?

Please summarize what you want to do before you ask the question again and again.

0 Karma

rchams
Explorer

@to4kawa 

I want to compare the average response time value in 1 hr for span=15 mins to same 1 hr time in yesterday (like 4 aggregate values). 

example i want to compare the average response time for the period 06/15/2020 3 PM to 4 PM with  06/16/2020 3 PM to 4 PM . Only 4 aggregate comparison values should be appear as my results. 
average value comparison 

Looking for results like below

timeframe          today-value     yesterday-value

15.15.00               00000                 00000

15.30.00               44444                 44444

15.45.00               11111                  11111

16.00.00                22222                  22222

0 Karma

to4kawa
Ultra Champion

please modify my query.

the result contains what you want.

 

0 Karma
Get Updates on the Splunk Community!

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...