<?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: Search  for group user activities based on Login Logout time in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-for-group-user-activities-based-on-Login-Logout/m-p/593460#M206555</link>
    <description>&lt;P&gt;You could do&lt;BR /&gt;| transaction user startswith=(login_time=* ) maxspan=8h&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This will group events by the user, where the first event starts with login_time and it won't go more than eight hours. That way it can start with the time of login.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Unless you want it to start from a certain time. In which case the string time value makes sense.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 12 Apr 2022 13:39:36 GMT</pubDate>
    <dc:creator>sperkins</dc:creator>
    <dc:date>2022-04-12T13:39:36Z</dc:date>
    <item>
      <title>How to search for group user activities based on Login Logout time?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-for-group-user-activities-based-on-Login-Logout/m-p/593342#M206514</link>
      <description>&lt;P data-unlink="true"&gt;Gentlemen&lt;BR /&gt;&lt;BR /&gt;My raw events have a field called &lt;STRONG&gt;login_time&lt;/STRONG&gt; which has values of format (&amp;nbsp;2022-04-11 10:52:08 )&amp;nbsp;.&amp;nbsp; This is the time an user logs in to the system.&amp;nbsp; There is &lt;STRONG&gt;no&lt;/STRONG&gt; logout_time field in raw data.&amp;nbsp; Now, the requirement is to track all activities done by the user starting from login_time and ending with login_time + 8 hours.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;1)&amp;nbsp; &amp;nbsp;How do i add this 8 hours to the login_time in my search ? Do i create an eval function something like eval logout_time = login time + 8:00:00 ?&amp;nbsp;&lt;BR /&gt;2) Transaction works with strings in startswith and endswith.&amp;nbsp; Can it be used to track time which is in&amp;nbsp; numerical format&amp;nbsp; as&amp;nbsp; shown in below query ?&amp;nbsp; &amp;nbsp; If not, how else to group all events done by the user within the login and logout time ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;index=xxxx
transaction startswith ="2022-04-11 10:52:08" endswith="2022-04-11 10:52:08 + 8 hrs"
| stats .... by user&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope i am clear&lt;/P&gt;</description>
      <pubDate>Tue, 12 Apr 2022 16:22:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-for-group-user-activities-based-on-Login-Logout/m-p/593342#M206514</guid>
      <dc:creator>neerajs_81</dc:creator>
      <dc:date>2022-04-12T16:22:12Z</dc:date>
    </item>
    <item>
      <title>Re: Search  for group user activities based on Login Logout time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-for-group-user-activities-based-on-Login-Logout/m-p/593346#M206516</link>
      <description>&lt;P&gt;try:&lt;/P&gt;&lt;H5&gt;&lt;STRONG&gt;| eval Epoch_login =strptime(login_time,”%Y-%m-%d %H:%M:%S”)&lt;BR /&gt;&lt;/STRONG&gt;&lt;/H5&gt;&lt;H5&gt;&lt;STRONG&gt;| eval log_out = relative_time(Epoch_login,"+8h")&lt;/STRONG&gt;&lt;/H5&gt;&lt;H5&gt;&lt;SPAN&gt;&lt;EM&gt;Use %I instead of %H, if it isn't in 24 hour time format, but in 12 hour.&lt;/EM&gt;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/H5&gt;&lt;P&gt;To use relative_time the time has to be in Epoch which is why I converted it first. Then added 8 hours to the epoch time to give you the log_out time&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/SCS/current/SearchReference/DateandTimeFunctions#relative_time.28.26.2360.3Btime.26.2362.3B.2C.26lt.3Bspecifier.26gt.3B.29" target="_blank" rel="noopener"&gt;https://docs.splunk.com/Documentation/SCS/current/SearchReference/DateandTimeFunctions#relative_time.28.26.2360.3Btime.26.2362.3B.2C.26lt.3Bspecifier.26gt.3B.29&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Apr 2022 19:17:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-for-group-user-activities-based-on-Login-Logout/m-p/593346#M206516</guid>
      <dc:creator>sperkins</dc:creator>
      <dc:date>2022-04-11T19:17:49Z</dc:date>
    </item>
    <item>
      <title>Re: Search  for group user activities based on Login Logout time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-for-group-user-activities-based-on-Login-Logout/m-p/593349#M206518</link>
      <description>&lt;P&gt;You can use fields to group transactions together. So group it by the user field and use the maxspan time to make sure the first activities and last are no more than 8 hours apart.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;| transaction user&amp;nbsp;&lt;SPAN&gt;maxspan=8h&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Apr 2022 19:16:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-for-group-user-activities-based-on-Login-Logout/m-p/593349#M206518</guid>
      <dc:creator>sperkins</dc:creator>
      <dc:date>2022-04-11T19:16:56Z</dc:date>
    </item>
    <item>
      <title>Re: Search  for group user activities based on Login Logout time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-for-group-user-activities-based-on-Login-Logout/m-p/593394#M206533</link>
      <description>&lt;P&gt;if i use&lt;STRONG&gt;&amp;nbsp;| transaction user&amp;nbsp;&lt;/STRONG&gt;&lt;SPAN&gt;&lt;STRONG&gt;maxspan=8h&lt;/STRONG&gt; ,&amp;nbsp; how can i tell Splunk where to start from ?&amp;nbsp; Any way to tell it to do something like this ?&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt; | transactions startswith="2022-04-11 08:00:00"  maxspan=8h&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Though in this case it will end up considering the timestamp mentioned above ,&amp;nbsp; as a string and so won't be able to add 8hours to it, and eventually the maxspan=8h&amp;nbsp; will fail.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Apr 2022 05:47:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-for-group-user-activities-based-on-Login-Logout/m-p/593394#M206533</guid>
      <dc:creator>neerajs_81</dc:creator>
      <dc:date>2022-04-12T05:47:43Z</dc:date>
    </item>
    <item>
      <title>Re: Search  for group user activities based on Login Logout time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-for-group-user-activities-based-on-Login-Logout/m-p/593395#M206534</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/244626"&gt;@sperkins&lt;/a&gt;&amp;nbsp;If i use these 2 evals, i see the value of eval is in Unix time.&amp;nbsp; So, will something like this work to get me all the activities performed by the user in that interval&amp;nbsp; ?&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt; | where _time &amp;gt; Epoch_login&amp;nbsp;and&amp;nbsp;_time&amp;nbsp;&amp;lt;&amp;nbsp;=&amp;nbsp;log_out&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Apr 2022 05:58:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-for-group-user-activities-based-on-Login-Logout/m-p/593395#M206534</guid>
      <dc:creator>neerajs_81</dc:creator>
      <dc:date>2022-04-12T05:58:28Z</dc:date>
    </item>
    <item>
      <title>Re: Search  for group user activities based on Login Logout time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-for-group-user-activities-based-on-Login-Logout/m-p/593403#M206537</link>
      <description>&lt;P&gt;Try and see, as a colleague of mine in previous workplace used to say &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;&lt;P&gt;But no, it won't be that simple. If you dom those evals you'll have the logout time in the login event. The search command doesn't know about this value. You'd need to either distribute it to the events as an additional fields with eventstats/streamstats to then&amp;nbsp; filter on a condition similar to that you just wrote. Or you can use transaction, as someone already showed.&lt;/P&gt;&lt;P&gt;One caveat though - what will happen if someone logs in twice during thkse 8 hours? And what would you like to get as a result in this case?&lt;/P&gt;</description>
      <pubDate>Tue, 12 Apr 2022 06:35:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-for-group-user-activities-based-on-Login-Logout/m-p/593403#M206537</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2022-04-12T06:35:21Z</dc:date>
    </item>
    <item>
      <title>Re: Search  for group user activities based on Login Logout time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-for-group-user-activities-based-on-Login-Logout/m-p/593460#M206555</link>
      <description>&lt;P&gt;You could do&lt;BR /&gt;| transaction user startswith=(login_time=* ) maxspan=8h&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This will group events by the user, where the first event starts with login_time and it won't go more than eight hours. That way it can start with the time of login.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Unless you want it to start from a certain time. In which case the string time value makes sense.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Apr 2022 13:39:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-for-group-user-activities-based-on-Login-Logout/m-p/593460#M206555</guid>
      <dc:creator>sperkins</dc:creator>
      <dc:date>2022-04-12T13:39:36Z</dc:date>
    </item>
  </channel>
</rss>

