<?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: Calculate time between events - query taking a long time in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Calculate-time-between-events-query-taking-a-long-time/m-p/186789#M53791</link>
    <description>&lt;P&gt;&lt;CODE&gt;eventstats&lt;/CODE&gt; would assign one value for all events, giving you incorrect durations. This may be made to work with &lt;CODE&gt;streamstats&lt;/CODE&gt; though.&lt;/P&gt;</description>
    <pubDate>Thu, 14 May 2015 14:35:04 GMT</pubDate>
    <dc:creator>martin_mueller</dc:creator>
    <dc:date>2015-05-14T14:35:04Z</dc:date>
    <item>
      <title>Calculate time between events - query taking a long time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Calculate-time-between-events-query-taking-a-long-time/m-p/186782#M53784</link>
      <description>&lt;P&gt;Here is my query:&lt;/P&gt;

&lt;P&gt;index=something st=something (EventID=9999 OR EventID=9998 OR EventID=9997 OR EventID=9996) | transaction maxspan=10s maxpause=2 host startswith=eval(EventID=9997 OR EventID=9996) endswith=eval(EventID=9999 OR EventID=9998)&lt;/P&gt;

&lt;P&gt;The first 2 events are the start of the event and the last 2 events are the end of the event.  Any help would be appreciated.  Thanks.&lt;/P&gt;</description>
      <pubDate>Tue, 12 May 2015 21:37:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Calculate-time-between-events-query-taking-a-long-time/m-p/186782#M53784</guid>
      <dc:creator>giguere1</dc:creator>
      <dc:date>2015-05-12T21:37:41Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate time between events - query taking a long time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Calculate-time-between-events-query-taking-a-long-time/m-p/186783#M53785</link>
      <description>&lt;P&gt;Help with what exactly?&lt;/P&gt;</description>
      <pubDate>Tue, 12 May 2015 22:06:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Calculate-time-between-events-query-taking-a-long-time/m-p/186783#M53785</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2015-05-12T22:06:53Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate time between events - query taking a long time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Calculate-time-between-events-query-taking-a-long-time/m-p/186784#M53786</link>
      <description>&lt;P&gt;I want to show the amount of time on a barchart per day that is transacting for all hosts in one number.  Right now this query, they way i have it, is taking far too long to gen.  I am looking for more efficient ways to do this.&lt;/P&gt;</description>
      <pubDate>Tue, 12 May 2015 22:08:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Calculate-time-between-events-query-taking-a-long-time/m-p/186784#M53786</guid>
      <dc:creator>giguere1</dc:creator>
      <dc:date>2015-05-12T22:08:38Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate time between events - query taking a long time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Calculate-time-between-events-query-taking-a-long-time/m-p/186785#M53787</link>
      <description>&lt;P&gt;To see what's taking up the time you could post the job inspector output.&lt;/P&gt;</description>
      <pubDate>Tue, 12 May 2015 22:21:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Calculate-time-between-events-query-taking-a-long-time/m-p/186785#M53787</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2015-05-12T22:21:23Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate time between events - query taking a long time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Calculate-time-between-events-query-taking-a-long-time/m-p/186786#M53788</link>
      <description>&lt;P&gt;The &lt;CODE&gt;transaction&lt;/CODE&gt; does many things that you don't appear to need; try this instead (simpler and quicker):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=something st=something (EventID=9999 OR EventID=9998 OR EventID=9997 OR EventID=9996) | stats earliest(_time) AS firstTime latest(_time) AS lastTime by host | eval duration=lastTime-firstTime
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 14 May 2015 00:08:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Calculate-time-between-events-query-taking-a-long-time/m-p/186786#M53788</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-05-14T00:08:37Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate time between events - query taking a long time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Calculate-time-between-events-query-taking-a-long-time/m-p/186787#M53789</link>
      <description>&lt;P&gt;This is going to break terribly as soon as one host has more than one transaction in the searched timespan.&lt;/P&gt;</description>
      <pubDate>Thu, 14 May 2015 09:15:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Calculate-time-between-events-query-taking-a-long-time/m-p/186787#M53789</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2015-05-14T09:15:16Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate time between events - query taking a long time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Calculate-time-between-events-query-taking-a-long-time/m-p/186788#M53790</link>
      <description>&lt;P&gt;As far as multiple transactions/hosts, so long as transaction events with the same host do not intermingle, this can also be handled without &lt;CODE&gt;transaction&lt;/CODE&gt; like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=something st=something (EventID=9999 OR EventID=9998 OR EventID=9997 OR EventID=9996) | eval startswith=if((EventID=9997 OR EventID=9996),_time,null()) | streamstats current=f last(startswith) AS startswithByHost by host | eval duration=startswithByHost-_time
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Once this is run, every event will contain 2 new fieds: &lt;CODE&gt;startswithByHost&lt;/CODE&gt; is the &lt;CODE&gt;_time&lt;/CODE&gt; value of the nearest previous &lt;CODE&gt;9997&lt;/CODE&gt; or &lt;CODE&gt;9996&lt;/CODE&gt; that shares the same &lt;CODE&gt;host&lt;/CODE&gt; value as this event and &lt;CODE&gt;duration&lt;/CODE&gt; is the difference between this event's &lt;CODE&gt;_time&lt;/CODE&gt; value and &lt;CODE&gt;startswithByHost&lt;/CODE&gt;.  Now the user can tack on any additional pipes/commands that he needs to finish his summary, all without the heavy overhead (which was the OP's original complaint, that of the "long time") of the &lt;CODE&gt;transaction&lt;/CODE&gt; command.&lt;/P&gt;</description>
      <pubDate>Thu, 14 May 2015 13:53:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Calculate-time-between-events-query-taking-a-long-time/m-p/186788#M53790</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-05-14T13:53:59Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate time between events - query taking a long time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Calculate-time-between-events-query-taking-a-long-time/m-p/186789#M53791</link>
      <description>&lt;P&gt;&lt;CODE&gt;eventstats&lt;/CODE&gt; would assign one value for all events, giving you incorrect durations. This may be made to work with &lt;CODE&gt;streamstats&lt;/CODE&gt; though.&lt;/P&gt;</description>
      <pubDate>Thu, 14 May 2015 14:35:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Calculate-time-between-events-query-taking-a-long-time/m-p/186789#M53791</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2015-05-14T14:35:04Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate time between events - query taking a long time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Calculate-time-between-events-query-taking-a-long-time/m-p/186790#M53792</link>
      <description>&lt;P&gt;Correct, I meant &lt;CODE&gt;streamstats&lt;/CODE&gt;; good catch!&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=something st=something (EventID=9999 OR EventID=9998 OR EventID=9997 OR EventID=9996) | eval startswith=if((EventID=9997 OR EventID=9996),_time,null()) | streamstats last(startswith) AS startswithByHost by host | eval duration=startswithByHost-_time
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 14 May 2015 14:57:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Calculate-time-between-events-query-taking-a-long-time/m-p/186790#M53792</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-05-14T14:57:50Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate time between events - query taking a long time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Calculate-time-between-events-query-taking-a-long-time/m-p/186791#M53793</link>
      <description>&lt;P&gt;AWESOME!  I'm trying this now.  Sorry guys, I was on vacation most of last week.&lt;BR /&gt;
-pg&lt;/P&gt;</description>
      <pubDate>Mon, 18 May 2015 15:40:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Calculate-time-between-events-query-taking-a-long-time/m-p/186791#M53793</guid>
      <dc:creator>giguere1</dc:creator>
      <dc:date>2015-05-18T15:40:13Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate time between events - query taking a long time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Calculate-time-between-events-query-taking-a-long-time/m-p/186792#M53794</link>
      <description>&lt;P&gt;Both streamstats and transcation are taking forever.  I talked to our enterprise admin and ran job inspector on the search.  Everything is failing because of a misconfig in dispatch.conf.  I guess we have a ticket in with splunk right now, but it looks like that will need to get cleaned up before any of this gets better.  Thanks for all your help.  I am still open to more ideas. &lt;BR /&gt;
-pg&lt;/P&gt;</description>
      <pubDate>Tue, 19 May 2015 16:55:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Calculate-time-between-events-query-taking-a-long-time/m-p/186792#M53794</guid>
      <dc:creator>giguere1</dc:creator>
      <dc:date>2015-05-19T16:55:42Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate time between events - query taking a long time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Calculate-time-between-events-query-taking-a-long-time/m-p/186793#M53795</link>
      <description>&lt;P&gt;All glory to the job inspector.&lt;/P&gt;</description>
      <pubDate>Tue, 19 May 2015 17:04:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Calculate-time-between-events-query-taking-a-long-time/m-p/186793#M53795</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2015-05-19T17:04:05Z</dc:date>
    </item>
  </channel>
</rss>

