<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Splunk Alert for Response Time- How to add the time condition value? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Splunk-Alert-for-Response-Time-How-to-add-the-time-condition/m-p/618561#M214995</link>
    <description>&lt;P&gt;Hi Team, I want a splunk search query for alert creation. My requirement is service Response time is &amp;gt; 3 seconds and&amp;nbsp; if it is continuous more than 10 min (&amp;gt; 10 min), then only I need to raise an alert.&lt;/P&gt;
&lt;P&gt;In search query i tried to use the where option for the response time, but for time condition can't able to write the query. Below is my search query. please help me how to add the time condition value in query itself.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;index=kpidata | eval ProcessingTime=ProcessingTimeMS/1000&lt;BR /&gt;| where ProcessingTime &amp;gt; 3&lt;/P&gt;</description>
    <pubDate>Thu, 27 Oct 2022 14:04:41 GMT</pubDate>
    <dc:creator>asplunk789</dc:creator>
    <dc:date>2022-10-27T14:04:41Z</dc:date>
    <item>
      <title>Splunk Alert for Response Time- How to add the time condition value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-Alert-for-Response-Time-How-to-add-the-time-condition/m-p/618561#M214995</link>
      <description>&lt;P&gt;Hi Team, I want a splunk search query for alert creation. My requirement is service Response time is &amp;gt; 3 seconds and&amp;nbsp; if it is continuous more than 10 min (&amp;gt; 10 min), then only I need to raise an alert.&lt;/P&gt;
&lt;P&gt;In search query i tried to use the where option for the response time, but for time condition can't able to write the query. Below is my search query. please help me how to add the time condition value in query itself.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;index=kpidata | eval ProcessingTime=ProcessingTimeMS/1000&lt;BR /&gt;| where ProcessingTime &amp;gt; 3&lt;/P&gt;</description>
      <pubDate>Thu, 27 Oct 2022 14:04:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-Alert-for-Response-Time-How-to-add-the-time-condition/m-p/618561#M214995</guid>
      <dc:creator>asplunk789</dc:creator>
      <dc:date>2022-10-27T14:04:41Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Alert for Response Time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-Alert-for-Response-Time-How-to-add-the-time-condition/m-p/618562#M214996</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/102648"&gt;@asplunk789&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;to try to answer to yur question I need two information:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;is there a message or an eventcode that says if the service is up or down?&lt;/LI&gt;&lt;LI&gt;is the time condition an additional condition to the one for response time or is it a different one?&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Thu, 27 Oct 2022 11:46:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-Alert-for-Response-Time-How-to-add-the-time-condition/m-p/618562#M214996</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2022-10-27T11:46:24Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Alert for Response Time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-Alert-for-Response-Time-How-to-add-the-time-condition/m-p/618563#M214997</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/161352"&gt;@gcusello&lt;/a&gt;&amp;nbsp; for the quick response.&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;is there a message or an eventcode that says if the service is up or down? --&amp;gt; its a just a message having more response time&lt;/LI&gt;&lt;LI&gt;is the time condition an additional condition to the one for response time or is it a different one? --&amp;gt; It's different one where the response is &amp;gt;3 seconds and it's continues more than 10 min (more than 10 min having &amp;gt;3 seconds&amp;nbsp; then&amp;nbsp; my service is having some issue and keep on responding with more response time. so need alert for this condition)&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Oct 2022 11:55:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-Alert-for-Response-Time-How-to-add-the-time-condition/m-p/618563#M214997</guid>
      <dc:creator>asplunk789</dc:creator>
      <dc:date>2022-10-27T11:55:01Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Alert for Response Time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-Alert-for-Response-Time-How-to-add-the-time-condition/m-p/618564#M214998</link>
      <description>&lt;P&gt;Thanks &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/161352"&gt;@gcusello&lt;/a&gt;&amp;nbsp;for the quick response.&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;is there a message or an eventcode that says if the service is up or down? --&amp;gt; its a just a message having more response time.&lt;/LI&gt;&lt;LI&gt;is the time condition an additional condition to the one for response time or is it a different one? --&amp;gt; It's different one where the response is &amp;gt;3 seconds and it's continues more than 10 min (more than 10 min having &amp;gt;3 seconds then my service is having some issue and keep on responding with more response time. so need alert for this condition)&lt;/LI&gt;&lt;/UL&gt;</description>
      <pubDate>Thu, 27 Oct 2022 11:58:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-Alert-for-Response-Time-How-to-add-the-time-condition/m-p/618564#M214998</guid>
      <dc:creator>asplunk789</dc:creator>
      <dc:date>2022-10-27T11:58:42Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Alert for Response Time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-Alert-for-Response-Time-How-to-add-the-time-condition/m-p/618565#M214999</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/102648"&gt;@asplunk789&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;it isn't stilll so clear: have you an event containing a string e.g. "system up"?&lt;/P&gt;&lt;P&gt;if yes, you want to know if you're receiving events with "system up" for more than 10 minutes, is it correct?&lt;/P&gt;&lt;P&gt;if this is your need you could try something like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;your_search&amp;gt; "system up"
| stats 
   earliest(_time) AS earliest
   latest(_time) AS latest
   BY response_time
| eval duration=latest-earliest
| where response_time&amp;gt;3 AND duration&amp;gt;600&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Oct 2022 12:08:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-Alert-for-Response-Time-How-to-add-the-time-condition/m-p/618565#M214999</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2022-10-27T12:08:37Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Alert for Response Time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-Alert-for-Response-Time-How-to-add-the-time-condition/m-p/618578#M215000</link>
      <description>&lt;P&gt;The field to calculate response time is ProcessingTimeMS correct?&lt;BR /&gt;How often does it poll/events received? e.g. 30 seconds, minute, etc...&lt;BR /&gt;Do you need to calculate this for multiple series of host/processes within the same search?&lt;/P&gt;</description>
      <pubDate>Thu, 27 Oct 2022 13:45:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-Alert-for-Response-Time-How-to-add-the-time-condition/m-p/618578#M215000</guid>
      <dc:creator>johnhuang</dc:creator>
      <dc:date>2022-10-27T13:45:41Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Alert for Response Time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-Alert-for-Response-Time-How-to-add-the-time-condition/m-p/618580#M215001</link>
      <description>&lt;P&gt;No I don't have anything string like that&amp;nbsp;"system up".&lt;/P&gt;&lt;P&gt;My requirement is only, response time for any service greater than 3 seconds that to it is continuing for 10 min. Then only I need to raise an alert for this issue.&lt;/P&gt;</description>
      <pubDate>Thu, 27 Oct 2022 13:54:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-Alert-for-Response-Time-How-to-add-the-time-condition/m-p/618580#M215001</guid>
      <dc:creator>asplunk789</dc:creator>
      <dc:date>2022-10-27T13:54:51Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Alert for Response Time- How to add the time condition value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-Alert-for-Response-Time-How-to-add-the-time-condition/m-p/618590#M215009</link>
      <description>&lt;P&gt;Here is one way of implementing it (assuming that&amp;nbsp;ProcessingTimeMS is the field that represents response time).&lt;BR /&gt;&lt;BR /&gt;This example generates and analyze the last 30 minutes of sample day.&amp;nbsp;&lt;/P&gt;&lt;UL class="lia-list-style-type-circle"&gt;&lt;LI&gt;Summarizes the last 10 minutes with min, avg, and max response time and populates each event for later filtering.&lt;/LI&gt;&lt;LI&gt;You can adjust the filter based on how strict you want it, for example&amp;nbsp;&lt;UL&gt;&lt;LI&gt;Every response time within last 10 minutes &amp;gt; 3&lt;UL&gt;&lt;LI&gt;last_10m_min_secs&amp;gt;3&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;If you want to use average response time:&amp;nbsp; last_10m_avg_secs&amp;gt;3&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;The reason to expand the search to say 30 minutes is to provide some historical data for reference. Having additional data will make a standalone alert more meaningful/useful. Of course, this creates some overhead which you need to consider.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults | eval start=now()-1800, end=now()
| eval range=MVAPPEND(start, end)
| mvexpand range | eval _time=range | fields _time
| makecontinuous _time span=30s | sort 0 -_time
| eval ProcessingTimeMS=(random() % 20000) + 1000

| eval time_secs=ProcessingTimeMS/1000 
| bucket _time span=1m | stats avg(time_secs) AS avg_secs max(time_secs) AS max_secs min(time_secs) AS min_secs BY _time
| eval stats_name=strftime(_time, "%Y-%m-%d %H:%M:%S")
| appendpipe [| where _time&amp;gt;relative_time(now(), "-10m@m")      | rename avg_secs AS time_secs
| stats avg(time_secs) AS avg_secs max(time_secs) AS max_secs min(time_secs) AS min_secs 
| foreach * [| eval &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;=ROUND(&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;) | eval last_10m_&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;=&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;]
| eval stats_name="_Last 10 Min Stats_"]
| eventstats max(last_10m_min_secs) AS last_10m_min_secs max(last_10m_max_secs) AS last_10m_max_secs max(last_10m_avg_secs) AS last_10m_avg_secs
| sort 0 - stats_name 
| foreach *secs [| eval &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;=ROUND(&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;)]
| eval stats_type="RESPONSE TIME"
| table stats_name stats_type avg_secs min_secs max_secs last_10m*

| where last_10m_avg_secs&amp;gt;3
| fields - last_*&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="johnhuang_0-1666882155185.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/22172iBACAA3DE576BA5B0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="johnhuang_0-1666882155185.png" alt="johnhuang_0-1666882155185.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Oct 2022 14:50:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-Alert-for-Response-Time-How-to-add-the-time-condition/m-p/618590#M215009</guid>
      <dc:creator>johnhuang</dc:creator>
      <dc:date>2022-10-27T14:50:56Z</dc:date>
    </item>
  </channel>
</rss>

