<?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 startswith in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Transaction-startswith/m-p/106390#M27663</link>
    <description>&lt;P&gt;Because we don't specify an 'endswith' or 'maxpause' it won't close the transaction at all.  Each transaction will start with the first user login and end on the last event for that user.  It will not start subsequent transactions for the same user in the same day.&lt;/P&gt;</description>
    <pubDate>Fri, 26 Apr 2013 14:07:31 GMT</pubDate>
    <dc:creator>emiller42</dc:creator>
    <dc:date>2013-04-26T14:07:31Z</dc:date>
    <item>
      <title>Transaction startswith</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Transaction-startswith/m-p/106386#M27659</link>
      <description>&lt;P&gt;Hello, &lt;BR /&gt;
i group my events in transactions by user and day&lt;BR /&gt;
...| transaction user day   and then calculate duration, eventcount, time of transaction started and finished&lt;BR /&gt;
in logs there are fields action_type and action_time&lt;BR /&gt;
i want transaction to start with action_type=login and action_time for this action_type for this user and day  is minimal, &lt;BR /&gt;
i.e. i want start transaction since first time user login  this day&lt;/P&gt;

&lt;P&gt;something like this... | transaction user day startswith=min(action_time for  action_type=login)&lt;/P&gt;

&lt;P&gt;What commands should i write?&lt;BR /&gt;
Thank a lot for answers!&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 13:47:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Transaction-startswith/m-p/106386#M27659</guid>
      <dc:creator>andrey2007</dc:creator>
      <dc:date>2020-09-28T13:47:27Z</dc:date>
    </item>
    <item>
      <title>Re: Transaction startswith</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Transaction-startswith/m-p/106387#M27660</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;... | transaction user day startswith(action_type="login")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This will start a transaction on first action_type="login" and not close it until the next day.&lt;/P&gt;

&lt;P&gt;When you use startswith, you can have it be freeform text, an eval, or a valid search string.  They have different syntax which is somewhat confusing in the documentation.  The () indicates search syntax instead of simple text matching.&lt;/P&gt;</description>
      <pubDate>Fri, 26 Apr 2013 00:19:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Transaction-startswith/m-p/106387#M27660</guid>
      <dc:creator>emiller42</dc:creator>
      <dc:date>2013-04-26T00:19:12Z</dc:date>
    </item>
    <item>
      <title>Re: Transaction startswith</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Transaction-startswith/m-p/106388#M27661</link>
      <description>&lt;P&gt;Thanks, but this way i will get number of transactions equal to number of user&lt;CODE&gt;s logins for this day, but i need 1 transaction with all user&lt;/CODE&gt; actions since first login for day&lt;/P&gt;</description>
      <pubDate>Fri, 26 Apr 2013 07:41:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Transaction-startswith/m-p/106388#M27661</guid>
      <dc:creator>andrey2007</dc:creator>
      <dc:date>2013-04-26T07:41:34Z</dc:date>
    </item>
    <item>
      <title>Re: Transaction startswith</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Transaction-startswith/m-p/106389#M27662</link>
      <description>&lt;P&gt;You could look at the &lt;CODE&gt;map&lt;/CODE&gt; command. Not much experience with that myself, but I believe that it could work here.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=blah earliest=@d action_type=login
| stats min(_time) as first_login by user 
| map search="search sourcetype=blah starttimeu=$first_login$ user=$user$ 
| table _time action_type user "
| eval time = strftime(_time, "%Y-%m-%d %H:%M:%S") 
| eval time_action = time . " - " . action_type 
| stats list(time_action) as Time-Action by user    
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This should produce a list like;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;user       Time-Action
-----------------------
bob        2013-04-25 11:22:33 - logout
           2013-04-25 11:22:20 - change_value
           2013-04-25 11:20:10 - login
           2013-04-25 09:30:52 - logout
           2013-04-25 09:26:14 - add_user
           2013-04-25 09:21:36 - login

caesar     2013-04-25 11:45:17 - logout
           2013-04-25 11:35:10 - list_products
           2013-04-25 11:17:39 - del_user
           2013-04-25 11:09:29 - login
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;...&lt;/P&gt;

&lt;P&gt;adding &lt;CODE&gt;| reverse |&lt;/CODE&gt; just before the final &lt;CODE&gt;stats&lt;/CODE&gt; will list the &lt;CODE&gt;Time-Action&lt;/CODE&gt; in chronological order (per user). &lt;/P&gt;

&lt;P&gt;This is perhaps not exactly what you want, and I'd be happy to see improvements to this query. Actually, it's the first time I've played with the &lt;CODE&gt;map&lt;/CODE&gt; command.&lt;/P&gt;

&lt;P&gt;EDIT: Typo in the search. Sorry.&lt;/P&gt;

&lt;P&gt;/K&lt;/P&gt;</description>
      <pubDate>Fri, 26 Apr 2013 09:28:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Transaction-startswith/m-p/106389#M27662</guid>
      <dc:creator>kristian_kolb</dc:creator>
      <dc:date>2013-04-26T09:28:00Z</dc:date>
    </item>
    <item>
      <title>Re: Transaction startswith</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Transaction-startswith/m-p/106390#M27663</link>
      <description>&lt;P&gt;Because we don't specify an 'endswith' or 'maxpause' it won't close the transaction at all.  Each transaction will start with the first user login and end on the last event for that user.  It will not start subsequent transactions for the same user in the same day.&lt;/P&gt;</description>
      <pubDate>Fri, 26 Apr 2013 14:07:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Transaction-startswith/m-p/106390#M27663</guid>
      <dc:creator>emiller42</dc:creator>
      <dc:date>2013-04-26T14:07:31Z</dc:date>
    </item>
    <item>
      <title>Re: Transaction startswith</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Transaction-startswith/m-p/106391#M27664</link>
      <description>&lt;P&gt;To  Emiller42 
I made this way and I got some transactions for the same user in the same day&lt;/P&gt;</description>
      <pubDate>Fri, 26 Apr 2013 19:15:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Transaction-startswith/m-p/106391#M27664</guid>
      <dc:creator>andrey2007</dc:creator>
      <dc:date>2013-04-26T19:15:49Z</dc:date>
    </item>
  </channel>
</rss>

