<?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: Eval time between events for transaction by group? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Eval-time-between-events-for-transaction-by-group/m-p/17828#M2514</link>
    <description>&lt;P&gt;Hi,
if I understood you right, you want to report on the time lapse intercuring between "transactions" coming from the same host. With respect to this, I'd follow this approach: &lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;create the transaction you are interested into; compute the time at which that transaction ended as *_time + duration*&lt;/LI&gt;
&lt;LI&gt;invert the time line, so that later events come after earlier events&lt;/LI&gt;
&lt;LI&gt;use streamstats to bring the previous' transaction end_time into current event, while taking care that only the last transaction from the same host is used &lt;/LI&gt;
&lt;LI&gt;compute the time gap&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;That would translate in something like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;some searh&amp;gt; | transaction host maxspan=10m maxpause=1m maxevents=10 
| eval end_time = _time + duration 
| sort + _time 
| streamstats avg(end_time) as prevendtime window=1 current=f global=false by host
| eval timegapsecs=round(_time - prevendtime,0)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;timegapssecs will be the amount of time (in seconds) passed between two consecutive transactions from the same host&lt;/P&gt;</description>
    <pubDate>Wed, 21 Jul 2010 20:15:12 GMT</pubDate>
    <dc:creator>Paolo_Prigione</dc:creator>
    <dc:date>2010-07-21T20:15:12Z</dc:date>
    <item>
      <title>Eval time between events for transaction by group?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Eval-time-between-events-for-transaction-by-group/m-p/17827#M2513</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;
I'd like to do a report that tells me how long a forwarder hasn't been active. I use transaction to join similar events and next i would like to group events by host end eval time distance. Im having problem figuring out how to eval distance between same host (group by sourceHost) transaction events and show that as result.&lt;BR /&gt;
Currently I use this search to get active forwarder connections:  &lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;index=_internal "group=tcpin_connections" startdaysago=1 | transaction sourceHost maxpause=2m maxevents=-1&lt;/CODE&gt;  &lt;/P&gt;

&lt;P&gt;This returns transactions for all uninterrupted connections, but i don't know how to calculate distance between events based od sourceHost and get information on how long a forwarder wasn't sending data.&lt;BR /&gt;
All searches on &lt;A href="http://www.splunk.com/wiki/Deploy:HowToFindLostForwarders" rel="nofollow"&gt;http://www.splunk.com/wiki/Deploy:HowToFindLostForwarders&lt;/A&gt; show how to get current information about non-active forwarders and not report for all forwarders in a time period.  &lt;/P&gt;

&lt;P&gt;thx &lt;/P&gt;</description>
      <pubDate>Wed, 21 Jul 2010 18:49:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Eval-time-between-events-for-transaction-by-group/m-p/17827#M2513</guid>
      <dc:creator>gljiva</dc:creator>
      <dc:date>2010-07-21T18:49:14Z</dc:date>
    </item>
    <item>
      <title>Re: Eval time between events for transaction by group?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Eval-time-between-events-for-transaction-by-group/m-p/17828#M2514</link>
      <description>&lt;P&gt;Hi,
if I understood you right, you want to report on the time lapse intercuring between "transactions" coming from the same host. With respect to this, I'd follow this approach: &lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;create the transaction you are interested into; compute the time at which that transaction ended as *_time + duration*&lt;/LI&gt;
&lt;LI&gt;invert the time line, so that later events come after earlier events&lt;/LI&gt;
&lt;LI&gt;use streamstats to bring the previous' transaction end_time into current event, while taking care that only the last transaction from the same host is used &lt;/LI&gt;
&lt;LI&gt;compute the time gap&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;That would translate in something like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;some searh&amp;gt; | transaction host maxspan=10m maxpause=1m maxevents=10 
| eval end_time = _time + duration 
| sort + _time 
| streamstats avg(end_time) as prevendtime window=1 current=f global=false by host
| eval timegapsecs=round(_time - prevendtime,0)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;timegapssecs will be the amount of time (in seconds) passed between two consecutive transactions from the same host&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jul 2010 20:15:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Eval-time-between-events-for-transaction-by-group/m-p/17828#M2514</guid>
      <dc:creator>Paolo_Prigione</dc:creator>
      <dc:date>2010-07-21T20:15:12Z</dc:date>
    </item>
    <item>
      <title>Re: Eval time between events for transaction by group?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Eval-time-between-events-for-transaction-by-group/m-p/17829#M2515</link>
      <description>&lt;P&gt;I use the following search to find forwarders that have not checked in for a while (in this case more than 3600 seconds, or one hour):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| metadata type=hosts index=foo | eval last_contact=now()-recentTime | where last_contact&amp;gt;3600
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If you drop the &lt;CODE&gt;where last_contact&amp;gt;3600&lt;/CODE&gt; you will get statistics for all your forwarders.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jul 2010 20:31:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Eval-time-between-events-for-transaction-by-group/m-p/17829#M2515</guid>
      <dc:creator>ftk</dc:creator>
      <dc:date>2010-07-21T20:31:02Z</dc:date>
    </item>
    <item>
      <title>Re: Eval time between events for transaction by group?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Eval-time-between-events-for-transaction-by-group/m-p/17830#M2516</link>
      <description>&lt;P&gt;I think that approach would not work in case: a) your forwarders collect data from remote hosts too, b) your indexer receives snmp or syslog data from the network. In both cases your list of hosts would be much longer that those with a forwarder installed.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jul 2010 20:35:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Eval-time-between-events-for-transaction-by-group/m-p/17830#M2516</guid>
      <dc:creator>Paolo_Prigione</dc:creator>
      <dc:date>2010-07-21T20:35:01Z</dc:date>
    </item>
    <item>
      <title>Re: Eval time between events for transaction by group?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Eval-time-between-events-for-transaction-by-group/m-p/17831#M2517</link>
      <description>&lt;P&gt;Thx again &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;  this is final search that I use as a dashboard: index=_internal "group=tcpin_connections" startdaysago=2 | transaction sourceHost maxpause=2m maxevents=-1 | eval end_time = _time + duration | sort + _time | streamstats sum(end_time) as prevendtime window=1 current=f global=false by sourceHost | eval ForwarderOfflineTime=round(_time - prevendtime,0) | where ForwarderOfflineTime NOT NULL | fields + sourceHost _time ForwarderOfflineTime  | rename _time as Time | convert timeformat="%H:%M:%S-%d.%m.%Y." ctime(Time)&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 09:15:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Eval-time-between-events-for-transaction-by-group/m-p/17831#M2517</guid>
      <dc:creator>gljiva</dc:creator>
      <dc:date>2020-09-28T09:15:21Z</dc:date>
    </item>
    <item>
      <title>Re: Eval time between events for transaction by group?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Eval-time-between-events-for-transaction-by-group/m-p/17832#M2518</link>
      <description>&lt;P&gt;Well, the question was based around forwarders not all hosts including syslog, hence I contained the scope of my answer to forwarders only.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jul 2010 21:07:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Eval-time-between-events-for-transaction-by-group/m-p/17832#M2518</guid>
      <dc:creator>ftk</dc:creator>
      <dc:date>2010-07-21T21:07:53Z</dc:date>
    </item>
  </channel>
</rss>

