<?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: How to edit my search to identify peak hours of transactions with API Gateway purchase logs? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-identify-peak-hours-of-transactions/m-p/270465#M81413</link>
    <description>&lt;P&gt;You are also correct, I could go about this 2 ways. For this test I chose I chose the timeframe 9AM hour, but this could be extended to be 9AM-9PM as Peak may be more than a single hour. &lt;/P&gt;

&lt;P&gt;I COULD also dynamically try to identify a peak time from the data that is coming in. For this test I chose the first option&lt;/P&gt;</description>
    <pubDate>Wed, 30 Mar 2016 16:53:30 GMT</pubDate>
    <dc:creator>tkwaller</dc:creator>
    <dc:date>2016-03-30T16:53:30Z</dc:date>
    <item>
      <title>How to edit my search to identify peak hours of transactions with API Gateway purchase logs?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-identify-peak-hours-of-transactions/m-p/270459#M81407</link>
      <description>&lt;P&gt;Here's what I am trying to do. Using API Gateway purchase logs, identify peak and non-peak times. I want to send an alert when there are no transactions within 2 minutes during peak times and also send an alert when there are no transactions within 5 minutes during non-peak times.&lt;/P&gt;

&lt;P&gt;So I started with trying to identify "peak" times. I thought I would use a time span. For this example, I was TRYING to use the 9AM hour span, but maybe that's not the best way to do this.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=apigateway host=*agg* *purchase/carts* userName=* | transaction transactionId startswith=Inbound endswith=Out* | eval time=strftime(_time, "%Y-%m-%d %H:%M:%S,%3Q") | eval TimeofDay=if(like(time, "%9:%"), "Peak", "OffPeak") | where TimeofDay="Peak" 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;So step 1 would be:&lt;BR /&gt;
What would be the best way to identify peak times of the day?&lt;/P&gt;</description>
      <pubDate>Wed, 30 Mar 2016 15:44:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-identify-peak-hours-of-transactions/m-p/270459#M81407</guid>
      <dc:creator>tkwaller</dc:creator>
      <dc:date>2016-03-30T15:44:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my search to identify peak hours of transactions with API Gateway purchase logs?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-identify-peak-hours-of-transactions/m-p/270460#M81408</link>
      <description>&lt;P&gt;If your data is running pretty real time and there are no major delays in the data coming in, why don't you just set up an alert to run every day at 10am to search the previous hour's worth of data and then do your transaction on that and then send out an alert if all the rest of the conditions are met? Same thing for non-peak times. &lt;/P&gt;

&lt;P&gt;Another way is to search date_hour=9. You can get pretty granular with it too and look specifically for when "(date_hour=9) OR (date_hour=10 AND date_minute&amp;lt;31)" - Now you could see a span of 1 hour and a half. &lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 09:13:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-identify-peak-hours-of-transactions/m-p/270460#M81408</guid>
      <dc:creator>jdunlea</dc:creator>
      <dc:date>2020-09-29T09:13:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my search to identify peak hours of transactions with API Gateway purchase logs?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-identify-peak-hours-of-transactions/m-p/270461#M81409</link>
      <description>&lt;P&gt;I suspect that you are using poorly chosen terminology in your question.  I believe when you write &lt;CODE&gt;identify&lt;/CODE&gt; you actually mean is &lt;CODE&gt;isolate&lt;/CODE&gt;, &lt;CODE&gt;flag&lt;/CODE&gt;, or similar.  Is that right?  In other words, are you trying to &lt;CODE&gt;discern&lt;/CODE&gt; an unknown peak time (pull it out of the data) or are you trying to exploit a known peak time (put it into the data)?&lt;/P&gt;</description>
      <pubDate>Wed, 30 Mar 2016 15:58:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-identify-peak-hours-of-transactions/m-p/270461#M81409</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2016-03-30T15:58:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my search to identify peak hours of transactions with API Gateway purchase logs?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-identify-peak-hours-of-transactions/m-p/270462#M81410</link>
      <description>&lt;P&gt;So theres are going to be several parts to this. Yes when I say "identify" you say "flag".  Trying to "flag" all times either Peak or Not Peak. &lt;/P&gt;</description>
      <pubDate>Wed, 30 Mar 2016 16:25:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-identify-peak-hours-of-transactions/m-p/270462#M81410</guid>
      <dc:creator>tkwaller</dc:creator>
      <dc:date>2016-03-30T16:25:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my search to identify peak hours of transactions with API Gateway purchase logs?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-identify-peak-hours-of-transactions/m-p/270463#M81411</link>
      <description>&lt;P&gt;Then I will use that to say something like if "Peak" and checkout count = 0 for 2 minutes send an alert OR &lt;BR /&gt;
If "Not Peak" and checkout count = 0 for 5 minutes send an alert&lt;/P&gt;</description>
      <pubDate>Wed, 30 Mar 2016 16:25:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-identify-peak-hours-of-transactions/m-p/270463#M81411</guid>
      <dc:creator>tkwaller</dc:creator>
      <dc:date>2016-03-30T16:25:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my search to identify peak hours of transactions with API Gateway purchase logs?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-identify-peak-hours-of-transactions/m-p/270464#M81412</link>
      <description>&lt;P&gt;I think there needs some clarification as to whether or not you already know which hours are peak and non-peak, or if you are trying to dynamically identify a peak time from the data that is coming in. &lt;/P&gt;

&lt;P&gt;I think from your question, you already know which times are peak and all you are trying to do is direct your transactional search and alert to look at data that pertains to that peak hour only. But I could be wrong. &lt;/P&gt;</description>
      <pubDate>Wed, 30 Mar 2016 16:30:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-identify-peak-hours-of-transactions/m-p/270464#M81412</guid>
      <dc:creator>jdunlea</dc:creator>
      <dc:date>2016-03-30T16:30:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my search to identify peak hours of transactions with API Gateway purchase logs?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-identify-peak-hours-of-transactions/m-p/270465#M81413</link>
      <description>&lt;P&gt;You are also correct, I could go about this 2 ways. For this test I chose I chose the timeframe 9AM hour, but this could be extended to be 9AM-9PM as Peak may be more than a single hour. &lt;/P&gt;

&lt;P&gt;I COULD also dynamically try to identify a peak time from the data that is coming in. For this test I chose the first option&lt;/P&gt;</description>
      <pubDate>Wed, 30 Mar 2016 16:53:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-identify-peak-hours-of-transactions/m-p/270465#M81413</guid>
      <dc:creator>tkwaller</dc:creator>
      <dc:date>2016-03-30T16:53:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my search to identify peak hours of transactions with API Gateway purchase logs?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-identify-peak-hours-of-transactions/m-p/270466#M81414</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=apigateway host=agg purchase/carts userName=* | transaction transactionId startswith=Inbound endswith=Out | eval HourOfDay=strftime(_time, "%H%M") | eval PeakOrOffPeak=if(((HourOfDay&amp;gt;=900) AND (HourOfDay&amp;lt;=1000)), "Peak", "OffPeak") | search PeakOrOffPeak="Peak"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You can then change the &lt;CODE&gt;if&lt;/CODE&gt; to a &lt;CODE&gt;case&lt;/CODE&gt; with more qualifications for &lt;CODE&gt;Peak&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Mar 2016 17:01:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-identify-peak-hours-of-transactions/m-p/270466#M81414</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2016-03-30T17:01:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my search to identify peak hours of transactions with API Gateway purchase logs?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-identify-peak-hours-of-transactions/m-p/270467#M81415</link>
      <description>&lt;P&gt;BOOYAH&lt;BR /&gt;
Thank you sir, of course it was my timestamp. Just broke it down too far. Form there I can get it right&lt;BR /&gt;
Thanks for the assistance!&lt;/P&gt;</description>
      <pubDate>Wed, 30 Mar 2016 20:33:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-identify-peak-hours-of-transactions/m-p/270467#M81415</guid>
      <dc:creator>tkwaller</dc:creator>
      <dc:date>2016-03-30T20:33:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my search to identify peak hours of transactions with API Gateway purchase logs?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-identify-peak-hours-of-transactions/m-p/270468#M81416</link>
      <description>&lt;P&gt;So I took the above search and did this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=java host=*byx* api_domain=purchase api_method=checkoutShoppingCart status=SUCCESS subscriber=xxx@gmail.com "app_name=Gen31Application" earliest=-5min@min latest=-2min@min| eval HourOfDay=strftime(_time, "%H%M") | eval PeakOrOffPeak=if(((HourOfDay&amp;gt;=900) AND (HourOfDay&amp;lt;=1700)), "Peak", "OffPeak") | bucket _time span=1min | stats count by _time, PeakOrOffPeak | eval Check1=if(PeakOrOffPeak = "OffPeak" AND count &amp;lt; 1, "Trigger", "Dont Trigger")| appendcols [search index=java host=*byx* api_domain=purchase api_method=checkoutShoppingCart status=SUCCESS subscriber=xxx@gmail.com "app_name=Gen31Application" earliest=-2min@min latest=now| eval HourOfDay=strftime(_time, "%H%M") | eval PeakOrOffPeak=if(((HourOfDay&amp;gt;=900) AND (HourOfDay&amp;lt;=1700)), "Peak", "OffPeak") | bucket _time span=1min | stats count by _time, PeakOrOffPeak | eval Check2=if(PeakOrOffPeak = "OffPeak" AND count &amp;lt; 1, "Trigger", "Dont Trigger")]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;What this does is eval 5 mintues ago to 2 minutes ago and then eval for Peak/OffPeak and a trigger condition&lt;BR /&gt;
THEN&lt;BR /&gt;
the search is run again  to eval 2 minutes ago to now and eval for Peak/OffPeak and a trigger condition. &lt;/P&gt;

&lt;P&gt;What I am trying to do is run this search and eval each minute and compare to the next minute. If anytime in the  5 minute span, 2 minutes = Trigger, then send an alert.&lt;/P&gt;

&lt;P&gt;But in testing I found that this wont work as if minute 5 and minute 4 both = Trigger, since they are both under Check1, then it will not trigger.&lt;BR /&gt;
Maybe this is not the best way to do this...any thoughts?&lt;/P&gt;

&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 04 Apr 2016 16:22:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-identify-peak-hours-of-transactions/m-p/270468#M81416</guid>
      <dc:creator>tkwaller</dc:creator>
      <dc:date>2016-04-04T16:22:32Z</dc:date>
    </item>
  </channel>
</rss>

