<?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: Transaction duration not working as expected in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Transaction-duration-not-working-as-expected/m-p/404216#M116927</link>
    <description>&lt;P&gt;@dowdag have you tried the following? Also after the transaction command have you validated that the two expected events are getting actually correlated or not? Can you add some sample events for startswith and endswith condition (mock/anonymize any sensitive information)?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; &amp;lt;yourCurrentSearch&amp;gt;
 | transaction CheckNumber startswith="Tender" endswith="PrintIntercept\:\:PrintXML finished" 
 | sort 0 - duration
 | table CheckNumber TimeStamp duration Info   
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Ideally you should try using stats for this kind of correlation which should work faster&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; &amp;lt;yourCurrentSearch&amp;gt; CheckNumber=* ("Tender" OR "PrintIntercept::PrintXML finished")
 | eval EventType=case(searchmatch("Tender"),"start",searchmatch("PrintIntercept::PrintXML finished"),"finish")
 | stats values(EventType) as EventType min(_time) as _time max(_time) as LatestTime values(Info) as Info by CheckNumber
 | search EventType="Tender" AND EventType="PrintIntercept::PrintXML finished" 
 | eval duration=LatestTime-_time
 | fields - LatestTime
 | sort 0 - duration
 | table CheckNumber _time duration Info
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 05 Jun 2019 05:04:33 GMT</pubDate>
    <dc:creator>niketn</dc:creator>
    <dc:date>2019-06-05T05:04:33Z</dc:date>
    <item>
      <title>Transaction duration not working as expected</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Transaction-duration-not-working-as-expected/m-p/404215#M116926</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;| transaction CheckNumber startswith="Tender" endswith="PrintIntercept\:\:PrintXML finished" 
| top  CheckNumber TimeStamp duration Info   showcount=false showperc=false
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I am getting back data but the duration column is 0, what did I miss?&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jun 2019 17:07:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Transaction-duration-not-working-as-expected/m-p/404215#M116926</guid>
      <dc:creator>dowdag</dc:creator>
      <dc:date>2019-06-04T17:07:25Z</dc:date>
    </item>
    <item>
      <title>Re: Transaction duration not working as expected</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Transaction-duration-not-working-as-expected/m-p/404216#M116927</link>
      <description>&lt;P&gt;@dowdag have you tried the following? Also after the transaction command have you validated that the two expected events are getting actually correlated or not? Can you add some sample events for startswith and endswith condition (mock/anonymize any sensitive information)?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; &amp;lt;yourCurrentSearch&amp;gt;
 | transaction CheckNumber startswith="Tender" endswith="PrintIntercept\:\:PrintXML finished" 
 | sort 0 - duration
 | table CheckNumber TimeStamp duration Info   
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Ideally you should try using stats for this kind of correlation which should work faster&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; &amp;lt;yourCurrentSearch&amp;gt; CheckNumber=* ("Tender" OR "PrintIntercept::PrintXML finished")
 | eval EventType=case(searchmatch("Tender"),"start",searchmatch("PrintIntercept::PrintXML finished"),"finish")
 | stats values(EventType) as EventType min(_time) as _time max(_time) as LatestTime values(Info) as Info by CheckNumber
 | search EventType="Tender" AND EventType="PrintIntercept::PrintXML finished" 
 | eval duration=LatestTime-_time
 | fields - LatestTime
 | sort 0 - duration
 | table CheckNumber _time duration Info
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 05 Jun 2019 05:04:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Transaction-duration-not-working-as-expected/m-p/404216#M116927</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2019-06-05T05:04:33Z</dc:date>
    </item>
    <item>
      <title>Re: Transaction duration not working as expected</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Transaction-duration-not-working-as-expected/m-p/404217#M116928</link>
      <description>&lt;P&gt;Hi @dowdag  ,&lt;/P&gt;

&lt;P&gt;Did you have a chance to check out any answers? If it worked, please resolve this post by approving it! If your problem is still not solved, keep us updated so that someone else can help you. &lt;/P&gt;

&lt;P&gt;Thanks for posting!&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jun 2019 21:58:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Transaction-duration-not-working-as-expected/m-p/404217#M116928</guid>
      <dc:creator>evania</dc:creator>
      <dc:date>2019-06-17T21:58:08Z</dc:date>
    </item>
  </channel>
</rss>

