<?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: Time Difference in the transaction in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Time-Difference-in-the-transaction/m-p/87108#M22269</link>
    <description>&lt;P&gt;Well, anytime you bucket you need to aggregate the data in some way by either doing an average, max, min etc.   If you just want to list them all you could do the following instead:&lt;/P&gt;

&lt;P&gt;| chart last(duration) by _time&lt;/P&gt;

&lt;P&gt;This is pretty close to what Kristian suggested below so I am not sure why you didn't like his answer?&lt;/P&gt;</description>
    <pubDate>Tue, 08 Oct 2013 14:54:28 GMT</pubDate>
    <dc:creator>okrabbe_splunk</dc:creator>
    <dc:date>2013-10-08T14:54:28Z</dc:date>
    <item>
      <title>Time Difference in the transaction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Time-Difference-in-the-transaction/m-p/87103#M22264</link>
      <description>&lt;P&gt;Below is a sample log, i want to find time difference. By this query &lt;BR /&gt;
index=[search] | transaction startswith="A started" endswith="A completed"&lt;BR /&gt;
i was able to find the rows from log.&lt;/P&gt;

&lt;P&gt;2013-10-04T07:54:05 Component   Log-level     A Started &lt;/P&gt;

&lt;P&gt;2013-10-04T07:54:09 Component       Log-level         A Completed&lt;/P&gt;

&lt;P&gt;x-axis should be plotted with span=1d and y-axis plotted with time difference value. Please help me.&lt;/P&gt;</description>
      <pubDate>Tue, 08 Oct 2013 12:34:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Time-Difference-in-the-transaction/m-p/87103#M22264</guid>
      <dc:creator>sanyonhhh</dc:creator>
      <dc:date>2013-10-08T12:34:42Z</dc:date>
    </item>
    <item>
      <title>Re: Time Difference in the transaction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Time-Difference-in-the-transaction/m-p/87104#M22265</link>
      <description>&lt;P&gt;You would use timechart.  Transaction already calculates the duration between start and end of a transaction.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=[search] | transaction startswith="A started" endswith="A completed
| timechart span=1d avg(duration)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 08 Oct 2013 12:49:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Time-Difference-in-the-transaction/m-p/87104#M22265</guid>
      <dc:creator>okrabbe_splunk</dc:creator>
      <dc:date>2013-10-08T12:49:56Z</dc:date>
    </item>
    <item>
      <title>Re: Time Difference in the transaction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Time-Difference-in-the-transaction/m-p/87105#M22266</link>
      <description>&lt;P&gt;Perhaps a timechart is what you are looking for, for plotting the &lt;CODE&gt;duration&lt;/CODE&gt; value over time for a certain transaction. &lt;CODE&gt;duration&lt;/CODE&gt; is calculated automatically by the &lt;CODE&gt;transaction&lt;/CODE&gt; command. See the example below, which works on standard apache web logs.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=access_combined earliest=-1h clientip=10.1.1.1 
| transaction clientip maxspan=3m
| timechart span=1m first(duration) by clientip 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Hope this helps,&lt;/P&gt;

&lt;P&gt;K&lt;/P&gt;</description>
      <pubDate>Tue, 08 Oct 2013 12:51:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Time-Difference-in-the-transaction/m-p/87105#M22266</guid>
      <dc:creator>kristian_kolb</dc:creator>
      <dc:date>2013-10-08T12:51:44Z</dc:date>
    </item>
    <item>
      <title>Re: Time Difference in the transaction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Time-Difference-in-the-transaction/m-p/87106#M22267</link>
      <description>&lt;P&gt;How to get that transaction time difference...the query which u given gives only average... i need the difference between every transaction happened, it present in same event.&lt;/P&gt;</description>
      <pubDate>Tue, 08 Oct 2013 14:07:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Time-Difference-in-the-transaction/m-p/87106#M22267</guid>
      <dc:creator>sanyonhhh</dc:creator>
      <dc:date>2013-10-08T14:07:20Z</dc:date>
    </item>
    <item>
      <title>Re: Time Difference in the transaction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Time-Difference-in-the-transaction/m-p/87107#M22268</link>
      <description>&lt;P&gt;yes duration is calculated but i need time difference between start pattern and end pattern not all.&lt;/P&gt;</description>
      <pubDate>Tue, 08 Oct 2013 14:08:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Time-Difference-in-the-transaction/m-p/87107#M22268</guid>
      <dc:creator>sanyonhhh</dc:creator>
      <dc:date>2013-10-08T14:08:49Z</dc:date>
    </item>
    <item>
      <title>Re: Time Difference in the transaction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Time-Difference-in-the-transaction/m-p/87108#M22269</link>
      <description>&lt;P&gt;Well, anytime you bucket you need to aggregate the data in some way by either doing an average, max, min etc.   If you just want to list them all you could do the following instead:&lt;/P&gt;

&lt;P&gt;| chart last(duration) by _time&lt;/P&gt;

&lt;P&gt;This is pretty close to what Kristian suggested below so I am not sure why you didn't like his answer?&lt;/P&gt;</description>
      <pubDate>Tue, 08 Oct 2013 14:54:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Time-Difference-in-the-transaction/m-p/87108#M22269</guid>
      <dc:creator>okrabbe_splunk</dc:creator>
      <dc:date>2013-10-08T14:54:28Z</dc:date>
    </item>
    <item>
      <title>Re: Time Difference in the transaction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Time-Difference-in-the-transaction/m-p/87109#M22270</link>
      <description>&lt;P&gt;&lt;CODE&gt;duration&lt;/CODE&gt; IS the time difference between start pattern and end pattern, i.e. startswith and endswith, for EACH transaction. The sample log in your question would have a &lt;CODE&gt;duration&lt;/CODE&gt; value of 4 (seconds), regardless of how many events there are IN the transaction.  &lt;/P&gt;

&lt;P&gt;Is there some other time difference you wish to calculate? Please provide more sample events, and a description of how you want it charted.&lt;/P&gt;

&lt;P&gt;/k&lt;/P&gt;</description>
      <pubDate>Tue, 08 Oct 2013 15:22:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Time-Difference-in-the-transaction/m-p/87109#M22270</guid>
      <dc:creator>kristian_kolb</dc:creator>
      <dc:date>2013-10-08T15:22:27Z</dc:date>
    </item>
    <item>
      <title>Re: Time Difference in the transaction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Time-Difference-in-the-transaction/m-p/87110#M22271</link>
      <description>&lt;P&gt;My reading is "I want every duration plotted, not first() or avg()".&lt;/P&gt;</description>
      <pubDate>Tue, 08 Oct 2013 16:13:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Time-Difference-in-the-transaction/m-p/87110#M22271</guid>
      <dc:creator>sowings</dc:creator>
      <dc:date>2013-10-08T16:13:14Z</dc:date>
    </item>
    <item>
      <title>Re: Time Difference in the transaction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Time-Difference-in-the-transaction/m-p/87111#M22272</link>
      <description>&lt;P&gt;If I understand what you are trying to say, you want a 24-hour chart with every transaction in that 24 hours and its respective duration.  I think there is some confusion by your use of the phrase "span=1d" because that is commonly a search argument to &lt;CODE&gt;timechart&lt;/CODE&gt; - which will have to do some statistical aggregation because that is all it knows.&lt;/P&gt;

&lt;P&gt;An approach that you can use with &lt;STRONG&gt;limited&lt;/STRONG&gt; data is something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=[search] earliest=@d latest=@d+1d
| transaction startswith="A started" endswith="A completed"
| table _time, duration
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This produces chartable data that is 24 hours wide with every data point in the sample represented.  BUT if you have more than a few hundred data points, it starts to fall apart fast.  Example - on a 1600x1200 screen, even if the chart is full screen you only have enough room for about 1500 data points (assuming 1 pixel per data point).  &lt;/P&gt;

&lt;P&gt;When you have a large number of data points and you need a somewhat sensical graph, that is where doing timechart and aggregating over time ranges is essential.  For example, over a 1 day search period take an average - or maximum or minimum or something - over a span=1m.  &lt;/P&gt;</description>
      <pubDate>Tue, 08 Oct 2013 18:06:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Time-Difference-in-the-transaction/m-p/87111#M22272</guid>
      <dc:creator>dwaddle</dc:creator>
      <dc:date>2013-10-08T18:06:55Z</dc:date>
    </item>
    <item>
      <title>Re: Time Difference in the transaction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Time-Difference-in-the-transaction/m-p/87112#M22273</link>
      <description>&lt;P&gt;Maybe, I could have been more clear with that. Given the timespans in my example, there will be not be more than one transaction per timeslice, so it does not matter which &lt;CODE&gt;avg(), min(), first()&lt;/CODE&gt; etc function is used.&lt;/P&gt;</description>
      <pubDate>Tue, 08 Oct 2013 18:51:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Time-Difference-in-the-transaction/m-p/87112#M22273</guid>
      <dc:creator>kristian_kolb</dc:creator>
      <dc:date>2013-10-08T18:51:23Z</dc:date>
    </item>
    <item>
      <title>Re: Time Difference in the transaction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Time-Difference-in-the-transaction/m-p/87113#M22274</link>
      <description>&lt;P&gt;Hi dwaddle, &lt;/P&gt;

&lt;P&gt;E.g. query works fine when the log result like below,&lt;/P&gt;

&lt;P&gt;2013-10-04T07:54:05 Component Log-level A Started &lt;BR /&gt;
2013-10-04T07:54:09 Component Log-level A Completed&lt;/P&gt;

&lt;P&gt;But it fails when it contains in-between lines, it aggregates all the lines time difference and giving it.&lt;/P&gt;

&lt;H2&gt;2013-10-04T07:54:05 Component Log-level A Started \ this is starts with content&lt;/H2&gt;

&lt;HR /&gt;

&lt;P&gt;2013-10-04T07:54:09 Component Log-level A Completed \ this is ends with content&lt;BR /&gt;
I need time difference for start and end content excluding the time difference in-between lines.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Oct 2013 11:54:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Time-Difference-in-the-transaction/m-p/87113#M22274</guid>
      <dc:creator>sanyonhhh</dc:creator>
      <dc:date>2013-10-09T11:54:01Z</dc:date>
    </item>
    <item>
      <title>Re: Time Difference in the transaction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Time-Difference-in-the-transaction/m-p/87114#M22275</link>
      <description>&lt;P&gt;&lt;CODE&gt;duration&lt;/CODE&gt; is calculated as the time difference between the first and last event in a transaction, regardless of how many events are in the transaction. &lt;/P&gt;

&lt;P&gt;I'm sorry, but perhaps you can give more sample data and explain why the &lt;CODE&gt;duration&lt;/CODE&gt;s you get are 'wrong'.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Oct 2013 12:37:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Time-Difference-in-the-transaction/m-p/87114#M22275</guid>
      <dc:creator>kristian_kolb</dc:creator>
      <dc:date>2013-10-09T12:37:43Z</dc:date>
    </item>
  </channel>
</rss>

