Splunk Search

Splunk alret

saidAb
Explorer

Hello everyone,

I am looking for a Splunk search query to get the duration time of three sequential response code 200. It is not about average time or duration of one message but if three Success message responses taken totally more than 10 seconds.

Thanks in advance.

Labels (3)
0 Karma

saidAb
Explorer

At this moment, all message responses come in less that 10 seconds. This okay.

We want to create an alert, that  if eg, next happens:

Time                                                                   message repose code

15:00:43                                                                              200

15:00:45                                                                              200

15:00:54                                                                              200

or

Time                                                                   message repose code

15:00:43                                                                              200

15:00:55                                                                              200

15:00:56                                                                              200

So if 3 responses code 200 come with no error response between, and totally, they take more than 10 seconds.

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Try it this way

| eval successtime=if(status=200,_time,null())
| streamstats range(successtime) as successrange count(successtime) as successcount window=3 by status reset_on_change=t
| where successcount=3 and successrange > 10
0 Karma

saidAb
Explorer

This gives almost the same result, time of succses events. This is useful for the future. For now I wait with this query, because it seems we need a field 'Duration' in message to check the performances of response call

0 Karma

saidAb
Explorer

I mean three consecutive respaces 2000.

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Did you mean that the response codes are all 200 but take more than 10 seconds?

If so, what do you want to do if there are non-200 responses?

Please clarify your requirement

0 Karma

saidAb
Explorer

I have another alert for non-200 response codes. For this one I want to see if three consecutive 200 responses, take more than 10 seconds totally. That means I will create an alert about this.

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

This is what my solution does - how does it not do what you expect? Please provide examples

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Try something like this

| eval successtime=if(status=200,_time,null())
| streamstats range(successtime) as successrange count(successtime) as successcount window=3 by status global=f
| where successcount=3 and successrange > 10
0 Karma

saidAb
Explorer

Thanks! This query gives some answer.  However, I still have to find the one with this situation:
I have another alert for non-200 response codes. For this one I want to see if three consecutive 200 responses, take more than 10 seconds totally. That means I will create an alert about this. So the query should result only this three consecutive 200 responses that together take more that 10 seconds.

0 Karma
Get Updates on the Splunk Community!

Get the T-shirt to Prove You Survived Splunk University Bootcamp

As if Splunk University, in Las Vegas, in-person, with three days of bootcamps and labs weren’t enough, now ...

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

Wondering How to Build Resiliency in the Cloud?

IT leaders are choosing Splunk Cloud as an ideal cloud transformation platform to drive business resilience,  ...