<?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 Transaction with start &amp;amp; end with the same time in _raw ? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Transaction-with-start-amp-end-with-the-same-time-in-raw/m-p/678205#M231941</link>
    <description>&lt;P&gt;I am trying to create a Transaction where my starting and ending 'event' have exactly the same time.&lt;/P&gt;&lt;P&gt;In _raw the time is "&lt;SPAN class=""&gt;Wed&lt;/SPAN&gt; &lt;SPAN class=""&gt;Feb&lt;/SPAN&gt; &lt;SPAN class=""&gt;21&lt;/SPAN&gt; &lt;SPAN class=""&gt;08:15:01&lt;/SPAN&gt; &lt;SPAN class=""&gt;CST&lt;/SPAN&gt; &lt;SPAN class=""&gt;2024"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;My current SPL is:&amp;nbsp;&amp;nbsp;| transaction keeporphans=true host aJobName startswith=("START of script") endswith=("COMPLETED OK" OR "ABORTED, exiting with status")&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;But my transaction only has the starting event. So I added the following which had no change ?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;| eval _time = case(&lt;BR /&gt;match(_raw, "COMPLETED OK"), _time +5,&lt;BR /&gt;match(_raw, "ABORTED"), _time +5,&lt;BR /&gt;true(),_time)&lt;BR /&gt;| sort _time&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;| transaction keeporphans=true host aJobName startswith=("START of script") endswith=("COMPLETED OK" OR "ABORTED, exiting with status")&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;When I added the above changes, when I look the the events in the 'Time' columns they are 5 seconds apart, yet Tranaction does not associate them ?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&lt;SPAN&gt;2/21/24&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;8:15:01.000 AM (Starting Event)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&lt;SPAN&gt;2/21/24&amp;nbsp;8:15:06.000 AM (Ending Event)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 21 Feb 2024 15:37:43 GMT</pubDate>
    <dc:creator>sjringo</dc:creator>
    <dc:date>2024-02-21T15:37:43Z</dc:date>
    <item>
      <title>Transaction with start &amp; end with the same time in _raw ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Transaction-with-start-amp-end-with-the-same-time-in-raw/m-p/678205#M231941</link>
      <description>&lt;P&gt;I am trying to create a Transaction where my starting and ending 'event' have exactly the same time.&lt;/P&gt;&lt;P&gt;In _raw the time is "&lt;SPAN class=""&gt;Wed&lt;/SPAN&gt; &lt;SPAN class=""&gt;Feb&lt;/SPAN&gt; &lt;SPAN class=""&gt;21&lt;/SPAN&gt; &lt;SPAN class=""&gt;08:15:01&lt;/SPAN&gt; &lt;SPAN class=""&gt;CST&lt;/SPAN&gt; &lt;SPAN class=""&gt;2024"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;My current SPL is:&amp;nbsp;&amp;nbsp;| transaction keeporphans=true host aJobName startswith=("START of script") endswith=("COMPLETED OK" OR "ABORTED, exiting with status")&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;But my transaction only has the starting event. So I added the following which had no change ?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;| eval _time = case(&lt;BR /&gt;match(_raw, "COMPLETED OK"), _time +5,&lt;BR /&gt;match(_raw, "ABORTED"), _time +5,&lt;BR /&gt;true(),_time)&lt;BR /&gt;| sort _time&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;| transaction keeporphans=true host aJobName startswith=("START of script") endswith=("COMPLETED OK" OR "ABORTED, exiting with status")&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;When I added the above changes, when I look the the events in the 'Time' columns they are 5 seconds apart, yet Tranaction does not associate them ?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&lt;SPAN&gt;2/21/24&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;8:15:01.000 AM (Starting Event)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&lt;SPAN&gt;2/21/24&amp;nbsp;8:15:06.000 AM (Ending Event)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Feb 2024 15:37:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Transaction-with-start-amp-end-with-the-same-time-in-raw/m-p/678205#M231941</guid>
      <dc:creator>sjringo</dc:creator>
      <dc:date>2024-02-21T15:37:43Z</dc:date>
    </item>
    <item>
      <title>Re: Transaction with start &amp; end with the same time in _raw ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Transaction-with-start-amp-end-with-the-same-time-in-raw/m-p/678271#M231951</link>
      <description>&lt;P&gt;Have you tried using the &lt;FONT face="courier new,courier"&gt;maxspan&lt;/FONT&gt; option to limit how far apart the &lt;FONT face="courier new,courier"&gt;startswith&lt;/FONT&gt; and &lt;FONT face="courier new,courier"&gt;endswith&lt;/FONT&gt; events can be?&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| transaction keeporphans=true host aJobName startswith=("START of script") endswith=("COMPLETED OK" OR "ABORTED, exiting with status") maxspan=0&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Feb 2024 20:47:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Transaction-with-start-amp-end-with-the-same-time-in-raw/m-p/678271#M231951</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2024-02-21T20:47:29Z</dc:date>
    </item>
    <item>
      <title>Re: Transaction with start &amp; end with the same time in _raw ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Transaction-with-start-amp-end-with-the-same-time-in-raw/m-p/678274#M231952</link>
      <description>&lt;P&gt;Putting maxspan option does work for the one particular event where the start/stop events happen at the same time.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The next issue that comes up is that there are around 80 "transactions" that I am monitoring that can have a duration of over an hour.&lt;/P&gt;&lt;P&gt;The only way I can think of making this work is to have two different transaction creation lines that are inside of a case statement?&amp;nbsp; &amp;nbsp;One with the maxspan and one without depending upon a job name that I am extracting earlier in my code...&lt;/P&gt;&lt;P&gt;Is that possible or do you have any other ideas/suggestions ?&lt;/P&gt;</description>
      <pubDate>Wed, 21 Feb 2024 21:05:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Transaction-with-start-amp-end-with-the-same-time-in-raw/m-p/678274#M231952</guid>
      <dc:creator>sjringo</dc:creator>
      <dc:date>2024-02-21T21:05:32Z</dc:date>
    </item>
    <item>
      <title>Re: Transaction with start &amp; end with the same time in _raw ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Transaction-with-start-amp-end-with-the-same-time-in-raw/m-p/678281#M231955</link>
      <description>&lt;P&gt;Eighty transactions of up to an hour is a new requirement that my previous suggestion will not handle.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The transaction command is pretty inefficient and will become less so when it has to track many transactions over a long time range.&lt;/P&gt;&lt;P&gt;Rather than help you with a specific, sub-optimal solution, let's see if there's another solution to the problem.&amp;nbsp; What problem are you trying to solve?&lt;/P&gt;</description>
      <pubDate>Wed, 21 Feb 2024 21:31:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Transaction-with-start-amp-end-with-the-same-time-in-raw/m-p/678281#M231955</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2024-02-21T21:31:27Z</dc:date>
    </item>
    <item>
      <title>Re: Transaction with start &amp; end with the same time in _raw ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Transaction-with-start-amp-end-with-the-same-time-in-raw/m-p/678286#M231958</link>
      <description>&lt;P&gt;Sure.. So, here it goes..&lt;BR /&gt;I have a dashboard that is tracking 'jobs'...&amp;nbsp; Completed jobs and this particular widget is tracking 'running' jobs (start but no end).&amp;nbsp; I might be tracking around 80 jobs but there should not be more than 5 or 6 'running' at any particular time.&amp;nbsp; So, not creating 80 transactions.&lt;/P&gt;
&lt;P&gt;Everything is working as designed but this one job that starts and ends at the same time showed up in my 'running' jobs widget and then is missing from my completed jobs widget.&lt;/P&gt;
&lt;P&gt;Once I run my initial 'search' for log events here is what im doing.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;index=anIndex sourcetype=aSourcetype (aJob1 OR aJob2 OR aJob3) AND ("START of script" OR "COMPLETED OK" OR "ABORTED, exiting with status" ) 

| rex field=_raw "Batch::(?&amp;lt;aJobName&amp;gt;[^\s]*)"
| transaction keeporphans=true host aJobName startswith=("START of script") endswith=("COMPLETED OK" OR "ABORTED, exiting with status")
| eval closed_txn = if ( isnull(closed_txn),0,closed_txn)
| search closed_txn=0
| sort _time
| eval aDay = strftime(_time, "%a. %b. %e, %Y")
| eval aStartTime=strftime(_time, "%H:%M:%S %p")
| eval aDuration=tostring((now()-_time), "duration")
| eval aEndTime = "--- Running ---"
| table aHostName aDay aJobName aStartTime aEndTime aDuration&lt;/LI-CODE&gt;
&lt;P&gt;But, this one job is causing me issues as Transaction is not picking up the start/end that have the same _time&lt;/P&gt;</description>
      <pubDate>Wed, 21 Feb 2024 22:02:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Transaction-with-start-amp-end-with-the-same-time-in-raw/m-p/678286#M231958</guid>
      <dc:creator>sjringo</dc:creator>
      <dc:date>2024-02-21T22:02:58Z</dc:date>
    </item>
    <item>
      <title>Re: Transaction with start &amp; end with the same time in _raw ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Transaction-with-start-amp-end-with-the-same-time-in-raw/m-p/678574#M232037</link>
      <description>&lt;P&gt;Here's a method that often works.&amp;nbsp; Search for Start and Completed events, keeping only the most recent for each host and job.&amp;nbsp; Then discard all of the Completed events.&amp;nbsp; What's left will be a list of uncompleted jobs.&lt;/P&gt;&lt;P&gt;This approach will fail if the Start and Complete events are at the exact time and in the wrong order.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=anIndex sourcetype=aSourcetype (aJob1 OR aJob2 OR aJob3) AND ("START of script" OR "COMPLETED OK" OR "ABORTED, exiting with status" ) 
| dedup host aJobName
| search "START of script"
| rex field=_raw "Batch::(?&amp;lt;aJobName&amp;gt;[^\s]*)"
| sort _time
| eval aDay = strftime(_time, "%a. %b. %e, %Y")
| eval aStartTime=strftime(_time, "%H:%M:%S %p")
| eval aDuration=tostring((now()-_time), "duration")
| eval aEndTime = "--- Running ---"
| table aHostName aDay aJobName aStartTime aEndTime aDuration&lt;/LI-CODE&gt;</description>
      <pubDate>Sat, 24 Feb 2024 21:23:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Transaction-with-start-amp-end-with-the-same-time-in-raw/m-p/678574#M232037</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2024-02-24T21:23:55Z</dc:date>
    </item>
    <item>
      <title>Re: Transaction with start &amp; end with the same time in _raw ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Transaction-with-start-amp-end-with-the-same-time-in-raw/m-p/678575#M232038</link>
      <description>&lt;P&gt;I was stuck on trying to get Transaction to work &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It was on my list of things to do, to write it similar to the way you did but had not had the time to get to it.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I ran a few tests and appears to solve the 'issue'&lt;/P&gt;&lt;P&gt;I dont know the specifics but I guess trying to 'alter' _time really does not change the underlying value ?&lt;/P&gt;</description>
      <pubDate>Sun, 25 Feb 2024 00:48:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Transaction-with-start-amp-end-with-the-same-time-in-raw/m-p/678575#M232038</guid>
      <dc:creator>sjringo</dc:creator>
      <dc:date>2024-02-25T00:48:17Z</dc:date>
    </item>
    <item>
      <title>Re: Transaction with start &amp; end with the same time in _raw ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Transaction-with-start-amp-end-with-the-same-time-in-raw/m-p/678576#M232039</link>
      <description>&lt;P&gt;You can change _time (or any field) in a query, but it doesn't change the indexed data (nothing does).&lt;/P&gt;</description>
      <pubDate>Sun, 25 Feb 2024 01:04:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Transaction-with-start-amp-end-with-the-same-time-in-raw/m-p/678576#M232039</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2024-02-25T01:04:54Z</dc:date>
    </item>
  </channel>
</rss>

