<?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 Pass earliest/latest in pipeline in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Pass-earliest-latest-in-pipeline/m-p/350775#M103830</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;Sorry for the newbie question.  We want to calculate percentage of time between 2 events over the entire search period.  We use transaction and get the sum of time between each pair of events:&lt;/P&gt;

&lt;P&gt;| transaction dest service startswith="CRITICAL;SOFT;1" endswith=OK | stats sum(duration) as total_downtime by dest&lt;/P&gt;

&lt;P&gt;But we've no idea how to pass the earliest(_time) and latest(_time) of   so that we can do the calculation like&lt;/P&gt;

&lt;P&gt;percentage = (total_downtime/(latest-earliest))*100&lt;/P&gt;

&lt;P&gt;Would anyone please help?&lt;BR /&gt;
Thanks a lot.&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 13:12:07 GMT</pubDate>
    <dc:creator>stwong</dc:creator>
    <dc:date>2020-09-29T13:12:07Z</dc:date>
    <item>
      <title>Pass earliest/latest in pipeline</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Pass-earliest-latest-in-pipeline/m-p/350775#M103830</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;Sorry for the newbie question.  We want to calculate percentage of time between 2 events over the entire search period.  We use transaction and get the sum of time between each pair of events:&lt;/P&gt;

&lt;P&gt;| transaction dest service startswith="CRITICAL;SOFT;1" endswith=OK | stats sum(duration) as total_downtime by dest&lt;/P&gt;

&lt;P&gt;But we've no idea how to pass the earliest(_time) and latest(_time) of   so that we can do the calculation like&lt;/P&gt;

&lt;P&gt;percentage = (total_downtime/(latest-earliest))*100&lt;/P&gt;

&lt;P&gt;Would anyone please help?&lt;BR /&gt;
Thanks a lot.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 13:12:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Pass-earliest-latest-in-pipeline/m-p/350775#M103830</guid>
      <dc:creator>stwong</dc:creator>
      <dc:date>2020-09-29T13:12:07Z</dc:date>
    </item>
    <item>
      <title>Re: Pass earliest/latest in pipeline</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Pass-earliest-latest-in-pipeline/m-p/350776#M103831</link>
      <description>&lt;P&gt;Hi stwong,&lt;BR /&gt;
try something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your_search
| transaction dest service startswith="CRITICAL;SOFT;1" endswith=OK 
| stats earliest(_time) AS Earliest latest(_time) AS Latest sum(duration) as total_downtime by dest 
| eval percentage = (total_downtime/(Latest-Earliest))*100
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Fri, 10 Mar 2017 10:27:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Pass-earliest-latest-in-pipeline/m-p/350776#M103831</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2017-03-10T10:27:11Z</dc:date>
    </item>
    <item>
      <title>Re: Pass earliest/latest in pipeline</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Pass-earliest-latest-in-pipeline/m-p/350777#M103832</link>
      <description>&lt;P&gt;Ditch &lt;CODE&gt;transaction&lt;/CODE&gt;; try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | search OK OR "CRITICAL;SOFT;1" | streamstats count(eval(searchmatch("CRITICAL;SOFT;1"))) AS sessionID BY dest service | stats range(_time) AS duration by dest service sessionID | stats sum(duration) as total_downtime by dest | addinfo | percentDown = 100 * (total_downtime)/(info_max_time - info_min_time)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 10 Mar 2017 15:29:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Pass-earliest-latest-in-pipeline/m-p/350777#M103832</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-03-10T15:29:08Z</dc:date>
    </item>
    <item>
      <title>Re: Pass earliest/latest in pipeline</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Pass-earliest-latest-in-pipeline/m-p/350778#M103833</link>
      <description>&lt;P&gt;Hi Giuseppe,&lt;/P&gt;

&lt;P&gt;Thanks.  Seems this returns time period of transaction.  Can I get the time span for "your_search" ?    It's Nagios log and logs status of all hosts.  Some are okay and some have down/up status change.  We hope to get the percentage of downtime of each host (period betwen down/up) over the entire period.&lt;/P&gt;

&lt;P&gt;Bye,&lt;BR /&gt;
/st&lt;/P&gt;</description>
      <pubDate>Fri, 10 Mar 2017 16:30:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Pass-earliest-latest-in-pipeline/m-p/350778#M103833</guid>
      <dc:creator>stwong</dc:creator>
      <dc:date>2017-03-10T16:30:38Z</dc:date>
    </item>
    <item>
      <title>Re: Pass earliest/latest in pipeline</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Pass-earliest-latest-in-pipeline/m-p/350779#M103834</link>
      <description>&lt;P&gt;Hi, thanks.  Tried addinfo before but seems add earliest/latest time for transaction instead of the first search in the pipe line.  &lt;/P&gt;

&lt;P&gt;Rgds&lt;BR /&gt;
/st&lt;/P&gt;</description>
      <pubDate>Fri, 10 Mar 2017 16:32:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Pass-earliest-latest-in-pipeline/m-p/350779#M103834</guid>
      <dc:creator>stwong</dc:creator>
      <dc:date>2017-03-10T16:32:47Z</dc:date>
    </item>
    <item>
      <title>Re: Pass earliest/latest in pipeline</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Pass-earliest-latest-in-pipeline/m-p/350780#M103835</link>
      <description>&lt;P&gt;In this way you have the first and the latest events of your results.&lt;BR /&gt;
to have earliest and latest you  should follow this answer:&lt;BR /&gt;
&lt;A href="https://answers.splunk.com/answers/334498/how-to-use-eval-on-a-token-from-a-time-picker-and.html"&gt;https://answers.splunk.com/answers/334498/how-to-use-eval-on-a-token-from-a-time-picker-and.html&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Fri, 10 Mar 2017 16:45:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Pass-earliest-latest-in-pipeline/m-p/350780#M103835</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2017-03-10T16:45:56Z</dc:date>
    </item>
    <item>
      <title>Re: Pass earliest/latest in pipeline</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Pass-earliest-latest-in-pipeline/m-p/350781#M103836</link>
      <description>&lt;P&gt;Why don't you fintune your Table &lt;/P&gt;

&lt;P&gt;Try this&lt;/P&gt;

&lt;P&gt;Host|now vs Latest max(transaction time in minutes)&lt;/P&gt;</description>
      <pubDate>Fri, 10 Mar 2017 16:57:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Pass-earliest-latest-in-pipeline/m-p/350781#M103836</guid>
      <dc:creator>puneethgowda</dc:creator>
      <dc:date>2017-03-10T16:57:20Z</dc:date>
    </item>
    <item>
      <title>Re: Pass earliest/latest in pipeline</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Pass-earliest-latest-in-pipeline/m-p/350782#M103837</link>
      <description>&lt;P&gt;Host 1 2 minutes &lt;BR /&gt;
Host 2 5 minutes &lt;BR /&gt;
Host 3 40 minutes &lt;/P&gt;

&lt;P&gt;Like this you can show what is the downtime of each server in minutes &lt;/P&gt;</description>
      <pubDate>Fri, 10 Mar 2017 17:00:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Pass-earliest-latest-in-pipeline/m-p/350782#M103837</guid>
      <dc:creator>puneethgowda</dc:creator>
      <dc:date>2017-03-10T17:00:07Z</dc:date>
    </item>
    <item>
      <title>Re: Pass earliest/latest in pipeline</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Pass-earliest-latest-in-pipeline/m-p/350783#M103838</link>
      <description>&lt;P&gt;Did you actually try my search?&lt;/P&gt;</description>
      <pubDate>Fri, 10 Mar 2017 21:06:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Pass-earliest-latest-in-pipeline/m-p/350783#M103838</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-03-10T21:06:02Z</dc:date>
    </item>
    <item>
      <title>Re: Pass earliest/latest in pipeline</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Pass-earliest-latest-in-pipeline/m-p/350784#M103839</link>
      <description>&lt;P&gt;Hi, yes, tried and see info_max_time = +infinity and info_min_time = 0.000.  thanks a lot.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 13:12:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Pass-earliest-latest-in-pipeline/m-p/350784#M103839</guid>
      <dc:creator>stwong</dc:creator>
      <dc:date>2020-09-29T13:12:26Z</dc:date>
    </item>
    <item>
      <title>Re: Pass earliest/latest in pipeline</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Pass-earliest-latest-in-pipeline/m-p/350785#M103840</link>
      <description>&lt;P&gt;Thanks, will study and give a try.&lt;/P&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
/st&lt;/P&gt;</description>
      <pubDate>Sat, 11 Mar 2017 11:47:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Pass-earliest-latest-in-pipeline/m-p/350785#M103840</guid>
      <dc:creator>stwong</dc:creator>
      <dc:date>2017-03-11T11:47:01Z</dc:date>
    </item>
    <item>
      <title>Re: Pass earliest/latest in pipeline</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Pass-earliest-latest-in-pipeline/m-p/350786#M103841</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | search OK OR "CRITICAL;SOFT;1" | streamstats count(eval(searchmatch("CRITICAL;SOFT;1"))) AS sessionID BY dest service | stats range(_time) AS duration min(_time) AS earliest BY dest service sessionID | stats sum(duration) as total_downtime min(earliest) AS earliest BY dest | eventstats min(earliest) AS earliest | percentDown = 100 * (total_downtime)/(now() - earliest)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Using search time parameters would be wrong because &lt;CODE&gt;0&lt;/CODE&gt; from all time would be from 1977.  This uses the oldest &lt;CODE&gt;_time&lt;/CODE&gt; value from all events returned in the search and &lt;CODE&gt;now()&lt;/CODE&gt; as the time frame.&lt;/P&gt;</description>
      <pubDate>Sat, 11 Mar 2017 15:33:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Pass-earliest-latest-in-pipeline/m-p/350786#M103841</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-03-11T15:33:42Z</dc:date>
    </item>
    <item>
      <title>Re: Pass earliest/latest in pipeline</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Pass-earliest-latest-in-pipeline/m-p/350787#M103842</link>
      <description>&lt;P&gt;Hello,  thanks.  I'm able to get the downtime of each server now. Just hope to get the percentage of downtime of each host over the entire search period (time between the first and last records for all hosts, or better to get the start/end time of time picker).  Thanks.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Mar 2017 03:25:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Pass-earliest-latest-in-pipeline/m-p/350787#M103842</guid>
      <dc:creator>stwong</dc:creator>
      <dc:date>2017-03-13T03:25:40Z</dc:date>
    </item>
    <item>
      <title>Re: Pass earliest/latest in pipeline</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Pass-earliest-latest-in-pipeline/m-p/350788#M103843</link>
      <description>&lt;P&gt;Thanks, will give it a try.&lt;/P&gt;

&lt;P&gt;Rgds&lt;/P&gt;</description>
      <pubDate>Mon, 13 Mar 2017 03:27:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Pass-earliest-latest-in-pipeline/m-p/350788#M103843</guid>
      <dc:creator>stwong</dc:creator>
      <dc:date>2017-03-13T03:27:10Z</dc:date>
    </item>
    <item>
      <title>Re: Pass earliest/latest in pipeline</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Pass-earliest-latest-in-pipeline/m-p/350789#M103844</link>
      <description>&lt;P&gt;Don't forget to upvote helpful answers and close the question by clicking &lt;CODE&gt;Accept&lt;/CODE&gt; on the best one.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Mar 2017 19:21:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Pass-earliest-latest-in-pipeline/m-p/350789#M103844</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-03-13T19:21:51Z</dc:date>
    </item>
  </channel>
</rss>

