<?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: Help with Transaction in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Help-with-Transaction/m-p/446791#M126714</link>
    <description>&lt;P&gt;Ok, fixing the syntax definitely gets a little closer. But it seems to be comparing each &lt;EM&gt;yes&lt;/EM&gt; with each &lt;EM&gt;no&lt;/EM&gt;. I just need to find the first &lt;EM&gt;yes&lt;/EM&gt;, then the first &lt;EM&gt;no&lt;/EM&gt; after the first &lt;EM&gt;yes&lt;/EM&gt;, and get that duration. then find the next &lt;EM&gt;yes&lt;/EM&gt; after that and the next &lt;EM&gt;no&lt;/EM&gt; after that and get that duration as well. And so on. I hope that makes sense. &lt;/P&gt;

&lt;P&gt;I just want to know how long the service was active and running. &lt;/P&gt;</description>
    <pubDate>Tue, 02 Jul 2019 02:51:36 GMT</pubDate>
    <dc:creator>pbarbuto</dc:creator>
    <dc:date>2019-07-02T02:51:36Z</dc:date>
    <item>
      <title>Help with Transaction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-Transaction/m-p/446789#M126712</link>
      <description>&lt;P&gt;I'm trying to to list out running sessions for a service. I am using timechart to list when its active and then simply looking for the duration of the running session.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;base search&amp;gt;
| timechart span=15m count
| eval running=if(count = "0","no","yes")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This returns&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;_time                count running
2019-07-01 07:00:00 0   no
2019-07-01 07:15:00 0   no
2019-07-01 07:30:00 16  yes
2019-07-01 07:45:00 19  yes
2019-07-01 08:00:00 5   yes
2019-07-01 08:15:00 3   yes
2019-07-01 08:30:00 8   yes
2019-07-01 08:45:00 1   yes
2019-07-01 09:00:00 0   no
2019-07-01 09:15:00 1   yes
2019-07-01 09:30:00 3   yes
2019-07-01 09:45:00 3   yes
2019-07-01 10:00:00 10  yes
2019-07-01 10:15:00 1   yes
2019-07-01 10:30:00 1   yes
2019-07-01 10:45:00 0   no
2019-07-01 11:00:00 0   no
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I can see that the service was running from 7:30-8:45 (Duration of 1:15) and again at 9:15-10:30 (Duration of 0:45).&lt;/P&gt;

&lt;P&gt;Im trying to get that running time by using Transaction like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;base search&amp;gt;
| timechart span=15m count
| eval running=if(count = "0","no","yes")
| transaction running startswith="yes" endswith="no"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But that isn't working. Any suggestions?&lt;/P&gt;</description>
      <pubDate>Mon, 01 Jul 2019 22:59:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-Transaction/m-p/446789#M126712</guid>
      <dc:creator>pbarbuto</dc:creator>
      <dc:date>2019-07-01T22:59:59Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Transaction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-Transaction/m-p/446790#M126713</link>
      <description>&lt;P&gt;The startswith and endswith fields are:&lt;/P&gt;

&lt;P&gt;"Description: A search or eval expression which, if satisfied by an event, marks the start/end of a transaction."&lt;/P&gt;

&lt;P&gt;Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| transaction  startswith="running=yes" endswith="running=no"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;There's probably a cleaner way to group the events before you get to the timechart, as well, but we'd have to look at the raw events to see for sure.&lt;/P&gt;

&lt;P&gt;Hope that helps.&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jul 2019 00:03:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-Transaction/m-p/446790#M126713</guid>
      <dc:creator>memarshall63</dc:creator>
      <dc:date>2019-07-02T00:03:40Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Transaction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-Transaction/m-p/446791#M126714</link>
      <description>&lt;P&gt;Ok, fixing the syntax definitely gets a little closer. But it seems to be comparing each &lt;EM&gt;yes&lt;/EM&gt; with each &lt;EM&gt;no&lt;/EM&gt;. I just need to find the first &lt;EM&gt;yes&lt;/EM&gt;, then the first &lt;EM&gt;no&lt;/EM&gt; after the first &lt;EM&gt;yes&lt;/EM&gt;, and get that duration. then find the next &lt;EM&gt;yes&lt;/EM&gt; after that and the next &lt;EM&gt;no&lt;/EM&gt; after that and get that duration as well. And so on. I hope that makes sense. &lt;/P&gt;

&lt;P&gt;I just want to know how long the service was active and running. &lt;/P&gt;</description>
      <pubDate>Tue, 02 Jul 2019 02:51:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-Transaction/m-p/446791#M126714</guid>
      <dc:creator>pbarbuto</dc:creator>
      <dc:date>2019-07-02T02:51:36Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Transaction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-Transaction/m-p/446792#M126715</link>
      <description>&lt;P&gt;The transaction command usually works with some sort of "session id" (or maybe in your case "serviceId") or common field that crosses all the events in a transaction.   My command above left it out because I didn't see one to use.   But, I can see maybe why that doesn't work.&lt;/P&gt;

&lt;P&gt;You might try inserting the transaction command before the timechart.   Letting it work on the raw data.  You'll be able to see in your data which events it's grouping.    Transaction command automatically inserts a "duration" field when it groups things, so you'll have that field, and if you're working with the raw data you won't be a slave to the 15min grouping that timechart is giving you.&lt;/P&gt;

&lt;P&gt;Transaction tends to be a heavy choice, and if you can find a way to use stats or something else to do the grouping, that'd probably be cheaper.&lt;/P&gt;

&lt;P&gt;Other things to try:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| transaction  endswith="running=no"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I didn't test it, but by removing the 'startswith' you may just get the timespans between "no's" -- and maybe that's closer to what you're looking for.&lt;/P&gt;

&lt;P&gt;Hope that helps.&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jul 2019 14:26:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-Transaction/m-p/446792#M126715</guid>
      <dc:creator>memarshall63</dc:creator>
      <dc:date>2019-07-02T14:26:27Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Transaction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-Transaction/m-p/446793#M126716</link>
      <description>&lt;P&gt;Hey that did it! Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jul 2019 18:21:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-Transaction/m-p/446793#M126716</guid>
      <dc:creator>pbarbuto</dc:creator>
      <dc:date>2019-07-02T18:21:03Z</dc:date>
    </item>
  </channel>
</rss>

