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
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!

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 ...

Network to App: Observability Unlocked [May & June Series]

In today’s digital landscape, your environment is no longer confined to the data center. It spans complex ...