<?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 Re: Count of API calls over X time_taken, only if average time_taken is over a threshold in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Count-of-API-calls-over-X-time-taken-only-if-average-time-taken/m-p/299458#M163791</link>
    <description>&lt;P&gt;How about this? YOu're already fetching avg time for a URI. You can just then get the count based on avg_duration as you're already filtering for avg_duration&amp;gt;threshold.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=mykplan_main cs_uri_stem="AAA" OR cs_uri_stem="BBB" 
| eval URI=cs_uri_stem 
| eval URI = lower(URI) 
| stats avg(eval(time_taken*.001)) as avg_duration by URI 
| eval avg_duration=round(avg_duration,2) 
| eval alert=if((avg_duration &amp;gt; 3 AND URI="AAA") OR (avg_duration &amp;gt; 1 AND URI="BBB") ,"alert", "ignore") 
| where alert="alert" 
| chart count by avg_duration
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 29 Sep 2020 17:31:26 GMT</pubDate>
    <dc:creator>somesoni2</dc:creator>
    <dc:date>2020-09-29T17:31:26Z</dc:date>
    <item>
      <title>Count of API calls over X time_taken, only if average time_taken is over a threshold</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Count-of-API-calls-over-X-time-taken-only-if-average-time-taken/m-p/299456#M163789</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I currently have a query that returns the a chart of API's whose calls average over a specific time limit (unique per API). I would then like to be able to display the count of calls over X seconds time_taken ONLY if that API had an average time_taken over X seconds. &lt;/P&gt;

&lt;P&gt;Would I be correct in thinking that I should make my first search a sub search and then search on that to find the counts of timed out APIs?  &lt;/P&gt;

&lt;P&gt;Here is my current search for the APIs with average time_taken over a limit. &lt;/P&gt;

&lt;P&gt;index=mykplan_main cs_uri_stem="AAA" OR cs_uri_stem="BBB"&lt;BR /&gt;&lt;BR /&gt;
   | eval URI=cs_uri_stem &lt;BR /&gt;
   | eval URI = lower(URI) &lt;BR /&gt;
   | stats avg(eval(time_taken*.001)) as avg_duration by URI &lt;BR /&gt;
   | eval avg_duration=round(avg_duration,2) &lt;BR /&gt;
   | eval alert=if((avg_duration &amp;gt; 3 AND URI="AAA") OR (avg_duration &amp;gt; 1 AND URI="BBB")  ,"alert", "ignore") &lt;BR /&gt;
   | where alert="alert" &lt;BR /&gt;
   | fields - alert &lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 17:35:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Count-of-API-calls-over-X-time-taken-only-if-average-time-taken/m-p/299456#M163789</guid>
      <dc:creator>pzhou07920</dc:creator>
      <dc:date>2020-09-29T17:35:40Z</dc:date>
    </item>
    <item>
      <title>Re: Count of API calls over X time_taken, only if average time_taken is over a threshold</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Count-of-API-calls-over-X-time-taken-only-if-average-time-taken/m-p/299457#M163790</link>
      <description>&lt;P&gt;You should be able to just add &lt;CODE&gt;count&lt;/CODE&gt; to your &lt;CODE&gt;stats&lt;/CODE&gt; command.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=mykplan_main cs_uri_stem="AAA" OR cs_uri_stem="BBB" 
| eval URI=cs_uri_stem 
| eval URI = lower(URI) 
| stats avg(eval(time_taken*.001)) as avg_duration, count by URI 
| eval avg_duration=round(avg_duration,2) 
| eval alert=if((avg_duration &amp;gt; 3 AND URI="AAA") OR (avg_duration &amp;gt; 1 AND URI="BBB") ,"alert", "ignore") 
| where alert="alert" 
| fields - alert
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 09 Jan 2018 16:10:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Count-of-API-calls-over-X-time-taken-only-if-average-time-taken/m-p/299457#M163790</guid>
      <dc:creator>micahkemp</dc:creator>
      <dc:date>2018-01-09T16:10:22Z</dc:date>
    </item>
    <item>
      <title>Re: Count of API calls over X time_taken, only if average time_taken is over a threshold</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Count-of-API-calls-over-X-time-taken-only-if-average-time-taken/m-p/299458#M163791</link>
      <description>&lt;P&gt;How about this? YOu're already fetching avg time for a URI. You can just then get the count based on avg_duration as you're already filtering for avg_duration&amp;gt;threshold.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=mykplan_main cs_uri_stem="AAA" OR cs_uri_stem="BBB" 
| eval URI=cs_uri_stem 
| eval URI = lower(URI) 
| stats avg(eval(time_taken*.001)) as avg_duration by URI 
| eval avg_duration=round(avg_duration,2) 
| eval alert=if((avg_duration &amp;gt; 3 AND URI="AAA") OR (avg_duration &amp;gt; 1 AND URI="BBB") ,"alert", "ignore") 
| where alert="alert" 
| chart count by avg_duration
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 29 Sep 2020 17:31:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Count-of-API-calls-over-X-time-taken-only-if-average-time-taken/m-p/299458#M163791</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2020-09-29T17:31:26Z</dc:date>
    </item>
    <item>
      <title>Re: Count of API calls over X time_taken, only if average time_taken is over a threshold</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Count-of-API-calls-over-X-time-taken-only-if-average-time-taken/m-p/299459#M163792</link>
      <description>&lt;P&gt;Doing this only returns a count of 1 for every result, I think it counts the avg duration or something. I preferably want to only get the count of API calls over the same avg_duration threshold I used but total count of events by URI should be okay too. &lt;/P&gt;</description>
      <pubDate>Tue, 09 Jan 2018 17:04:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Count-of-API-calls-over-X-time-taken-only-if-average-time-taken/m-p/299459#M163792</guid>
      <dc:creator>pzhou07920</dc:creator>
      <dc:date>2018-01-09T17:04:46Z</dc:date>
    </item>
    <item>
      <title>Re: Count of API calls over X time_taken, only if average time_taken is over a threshold</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Count-of-API-calls-over-X-time-taken-only-if-average-time-taken/m-p/528513#M163793</link>
      <description>&lt;P&gt;Hi ,&lt;/P&gt;&lt;P&gt;I am new to Splunk... We are pulling our logs from cloudwatch into splunk.&lt;/P&gt;&lt;P&gt;I want to create a dashboard to show the number of API calls by response - 2xx, 4xx and 5xx.&lt;/P&gt;&lt;P&gt;Basically I want to count the numbers of alerts for each response type for the API call.&lt;/P&gt;&lt;P&gt;Can you please help.&lt;/P&gt;</description>
      <pubDate>Mon, 09 Nov 2020 10:32:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Count-of-API-calls-over-X-time-taken-only-if-average-time-taken/m-p/528513#M163793</guid>
      <dc:creator>rekhan</dc:creator>
      <dc:date>2020-11-09T10:32:22Z</dc:date>
    </item>
  </channel>
</rss>

