<?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: Group users by computer name based on usage in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Group-users-by-computer-name-based-on-usage/m-p/336551#M99862</link>
    <description>&lt;P&gt;Agreed! Your point on evicted and orphaned searches is transactions is right.&lt;BR /&gt;
Thanks for sharing the flowchart.&lt;/P&gt;</description>
    <pubDate>Tue, 06 Jun 2017 10:40:13 GMT</pubDate>
    <dc:creator>dineshraj9</dc:creator>
    <dc:date>2017-06-06T10:40:13Z</dc:date>
    <item>
      <title>Group users by computer name based on usage</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Group-users-by-computer-name-based-on-usage/m-p/336546#M99857</link>
      <description>&lt;P&gt;I am trying to display a table of users usage for each individual computer that they have used. I can get the result I want when I search for an individual user using the search below:&lt;/P&gt;

&lt;P&gt;index=windows_os user=User3 tag::host=INC000001498678 (EventCode=4624 OR EventCode=4647)&lt;BR /&gt;
|transaction host startswith="4624" endswith="4647"&lt;BR /&gt;
|eval "Time" = round(duration/60,0) &lt;BR /&gt;
|stats sum(Time)  count by host &lt;BR /&gt;
|table host, sum(Time)&lt;/P&gt;

&lt;P&gt;RESULT:&lt;BR /&gt;
host                     sum(Time)&lt;BR /&gt;
MU00043103   14&lt;BR /&gt;
MU00042261       31&lt;/P&gt;

&lt;P&gt;What I want to do is set user to * or not specify a user to view all users. I have tried the following:&lt;/P&gt;

&lt;P&gt;index=windows_os tag::host=INC000001498678 (EventCode=4624 OR EventCode=4647) user!=SYSTEM user!="ANONYMOUS LOGON" user!=MU*$&lt;BR /&gt;
| transaction host startswith="4624" endswith="4647"&lt;BR /&gt;
| table user, host, duration &lt;BR /&gt;
| eval "Time" = round(duration/60,2) &lt;BR /&gt;
| table user, host, "Time"&lt;BR /&gt;
| sort user&lt;/P&gt;

&lt;P&gt;RESULTS:&lt;BR /&gt;
user            host                    Time&lt;BR /&gt;
User1       MU00041577  105&lt;BR /&gt;
User2       MU00041691  10&lt;BR /&gt;
User3             MU00043103             9&lt;BR /&gt;
User3             MU00042261        22&lt;BR /&gt;
User3             MU00043103    5&lt;BR /&gt;
User3             MU00042261    9&lt;BR /&gt;
User 4          MU00041691  8&lt;BR /&gt;
User5       MU00081455  3&lt;BR /&gt;
User5           MU00081455  3&lt;BR /&gt;
User5           MU00081455  4&lt;BR /&gt;
User5       MU00081455  3&lt;/P&gt;

&lt;P&gt;However, when I use the search above the events are not grouping each user on each computer. The result I would like to see is:&lt;/P&gt;

&lt;P&gt;RESULTS:&lt;BR /&gt;
user            host                    Time&lt;BR /&gt;
User1       MU00041577  105&lt;BR /&gt;
User2       MU00041691  10&lt;BR /&gt;
User3             MU00043103             14&lt;BR /&gt;
User3             MU00042261         31&lt;BR /&gt;
User4           MU00041691   8&lt;BR /&gt;
User5       MU00081455   13&lt;/P&gt;

&lt;P&gt;Any help would be much appreciated.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Jun 2017 00:55:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Group-users-by-computer-name-based-on-usage/m-p/336546#M99857</guid>
      <dc:creator>ykobak</dc:creator>
      <dc:date>2017-06-06T00:55:04Z</dc:date>
    </item>
    <item>
      <title>Re: Group users by computer name based on usage</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Group-users-by-computer-name-based-on-usage/m-p/336547#M99858</link>
      <description>&lt;P&gt;Can can modify your search to below -&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=windows_os tag::host=INC000001498678 (EventCode=4624 OR EventCode=4647) user!=SYSTEM user!="ANONYMOUS LOGON" user!=MU*$
| transaction user host startswith="4624" endswith="4647"
| table user, host, duration 
| eval Time = round(duration/60,2) 
| stats sum(Time) as Time by user host
| sort user
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You need to add &lt;CODE&gt;user&lt;/CODE&gt; field in the transaction command, else a transaction may start for a particular user and end for another making data inconsistent. Finally you can take the sum of duration a particular user spent on a host and then sort the results.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Jun 2017 08:30:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Group-users-by-computer-name-based-on-usage/m-p/336547#M99858</guid>
      <dc:creator>dineshraj9</dc:creator>
      <dc:date>2017-06-06T08:30:25Z</dc:date>
    </item>
    <item>
      <title>Re: Group users by computer name based on usage</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Group-users-by-computer-name-based-on-usage/m-p/336548#M99859</link>
      <description>&lt;P&gt;If you want to stick to transaction, you should add &lt;STRONG&gt;user&lt;/STRONG&gt; also as your transaction key as suggested by dineshraj9 i.e.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| transaction user host startswith="4624" endswith="4647"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;However, transaction is not suitable command for second scenario. It is more suitable when you want to stitch all events together for a single key value like sessionID, or as in your first query you have created the same only for one user and also one host.&lt;/P&gt;

&lt;P&gt;Try converting your transaction query to stats:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=windows_os tag::host=INC000001498678 (EventCode=4624 OR EventCode=4647) user!=SYSTEM user!="ANONYMOUS LOGON" user!=MU*$
| stats count as eventcount min(_time) as MinTime max(_time) as MaxTime values(EventCode) as EventCode by user host
| search eventcount&amp;gt;1 EventCode="4624" EventCode="4647"
| eval duration= MaxTime-MinTime
| eval "Time (in min)" = round(duration/60,2) 
| eval _time=MinTime
| sort user, host
| table _time user host "Time (in min)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 06 Jun 2017 08:42:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Group-users-by-computer-name-based-on-usage/m-p/336548#M99859</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-06-06T08:42:47Z</dc:date>
    </item>
    <item>
      <title>Re: Group users by computer name based on usage</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Group-users-by-computer-name-based-on-usage/m-p/336549#M99860</link>
      <description>&lt;P&gt;I agree that using stats can provide a performance improvement in this case, but transaction supports multiple field list -&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/SplunkCloud/6.6.0/SearchReference/Transaction"&gt;http://docs.splunk.com/Documentation/SplunkCloud/6.6.0/SearchReference/Transaction&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;Optional arguments&lt;BR /&gt;
field-list&lt;BR /&gt;
Syntax:  ...&lt;BR /&gt;
Description: One field or more field names. The events are grouped into transactions based on the values of this field. If a quoted list of fields is specified, events are grouped together if they have the same value for each of the fields.&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Jun 2017 08:49:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Group-users-by-computer-name-based-on-usage/m-p/336549#M99860</guid>
      <dc:creator>dineshraj9</dc:creator>
      <dc:date>2017-06-06T08:49:28Z</dc:date>
    </item>
    <item>
      <title>Re: Group users by computer name based on usage</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Group-users-by-computer-name-based-on-usage/m-p/336550#M99861</link>
      <description>&lt;P&gt;@dineshraj9 using  &lt;CODE&gt;by user host&lt;/CODE&gt; in stats or &lt;CODE&gt;transaction user host&lt;/CODE&gt; will give the same result. Events will be aggregated based on both &lt;STRONG&gt;user&lt;/STRONG&gt; and &lt;STRONG&gt;host&lt;/STRONG&gt; fields in both scenarios. With large dataset transaction may not just run slow, it can treat some records as evicted or orphaned and drop from transaction (keepevicted=t keeporphaned=t).&lt;/P&gt;

&lt;P&gt;Although there is no hard-and-fast rule for specific correlation to be used  Following flowchart by Nick Mealy&lt;BR /&gt;
gives and idea of situations where one method might be preferred over another: &lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/Search/Abouteventcorrelation"&gt;http://docs.splunk.com/Documentation/Splunk/latest/Search/Abouteventcorrelation&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Jun 2017 10:13:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Group-users-by-computer-name-based-on-usage/m-p/336550#M99861</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-06-06T10:13:33Z</dc:date>
    </item>
    <item>
      <title>Re: Group users by computer name based on usage</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Group-users-by-computer-name-based-on-usage/m-p/336551#M99862</link>
      <description>&lt;P&gt;Agreed! Your point on evicted and orphaned searches is transactions is right.&lt;BR /&gt;
Thanks for sharing the flowchart.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Jun 2017 10:40:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Group-users-by-computer-name-based-on-usage/m-p/336551#M99862</guid>
      <dc:creator>dineshraj9</dc:creator>
      <dc:date>2017-06-06T10:40:13Z</dc:date>
    </item>
    <item>
      <title>Re: Group users by computer name based on usage</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Group-users-by-computer-name-based-on-usage/m-p/336552#M99863</link>
      <description>&lt;P&gt;Thank you so much. I didn't know you can have multiple fields after the transaction command.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Jun 2017 23:17:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Group-users-by-computer-name-based-on-usage/m-p/336552#M99863</guid>
      <dc:creator>ykobak</dc:creator>
      <dc:date>2017-06-06T23:17:45Z</dc:date>
    </item>
  </channel>
</rss>

