<?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 timespan between earliest and latest per day per user in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/timespan-between-earliest-and-latest-per-day-per-user/m-p/115371#M30567</link>
    <description>&lt;P&gt;Hi all,&lt;BR /&gt;
I am looking for a solution to show for every day of a week the time of the first activity of a user and the time of its last activity (and the time span between them).&lt;BR /&gt;
I wanted to use transactions, but from what I understood, I need to know the exact event name to use it... but without transaction it does not seem to work:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="WinEventLog:Security" | eval User = if(isnull(Account_Name), User_Name, mvindex(Account_Name,1)) | stats earliest(_time) as start, latest(_time) as stop by User
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;any advice or help would be very appreciated,&lt;/P&gt;

&lt;P&gt;Steven&lt;/P&gt;</description>
    <pubDate>Mon, 23 Jun 2014 13:49:42 GMT</pubDate>
    <dc:creator>zendataCH</dc:creator>
    <dc:date>2014-06-23T13:49:42Z</dc:date>
    <item>
      <title>timespan between earliest and latest per day per user</title>
      <link>https://community.splunk.com/t5/Splunk-Search/timespan-between-earliest-and-latest-per-day-per-user/m-p/115371#M30567</link>
      <description>&lt;P&gt;Hi all,&lt;BR /&gt;
I am looking for a solution to show for every day of a week the time of the first activity of a user and the time of its last activity (and the time span between them).&lt;BR /&gt;
I wanted to use transactions, but from what I understood, I need to know the exact event name to use it... but without transaction it does not seem to work:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="WinEventLog:Security" | eval User = if(isnull(Account_Name), User_Name, mvindex(Account_Name,1)) | stats earliest(_time) as start, latest(_time) as stop by User
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;any advice or help would be very appreciated,&lt;/P&gt;

&lt;P&gt;Steven&lt;/P&gt;</description>
      <pubDate>Mon, 23 Jun 2014 13:49:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/timespan-between-earliest-and-latest-per-day-per-user/m-p/115371#M30567</guid>
      <dc:creator>zendataCH</dc:creator>
      <dc:date>2014-06-23T13:49:42Z</dc:date>
    </item>
    <item>
      <title>Re: timespan between earliest and latest per day per user</title>
      <link>https://community.splunk.com/t5/Splunk-Search/timespan-between-earliest-and-latest-per-day-per-user/m-p/115372#M30568</link>
      <description>&lt;P&gt;I could be misinterpreting you zendataCH, but this is what I came-up with - for data, I used a source that contains its own 'time' field, and found it convenient to operate on those instead. If your events contain their own timestamp, that might work for you too.&lt;/P&gt;

&lt;P&gt;I used the 'min' and 'max' stats commands, but grouped them by both the username /and/ the day of the week.&lt;/P&gt;

&lt;P&gt;Sample Syntax:&lt;/P&gt;

&lt;P&gt;sourcetype=juniper | stats min(time), max(time) BY user,date_wday&lt;/P&gt;

&lt;P&gt;This returns approximately the following:&lt;/P&gt;

&lt;P&gt;ALTOID   thursday    2014-06-19 14:14:00     2014-06-19 20:23:06&lt;BR /&gt;
ANYPAY   monday          2014-06-23 06:40:17     2014-06-23 07:03:05&lt;BR /&gt;
APEFAN   thursday    2014-06-19 14:10:44     2014-06-19 14:22:31&lt;BR /&gt;
ANKLES   friday          2014-06-20 09:59:33     2014-06-20 15:58:59&lt;BR /&gt;
(...)&lt;/P&gt;

&lt;P&gt;I haven't figured-out calculating the difference in time between the two events yet, but I bet an eval is the answer for that.&lt;/P&gt;

&lt;P&gt;Your mileage, of course, may vary.&lt;/P&gt;

&lt;P&gt;Good luck!&lt;/P&gt;</description>
      <pubDate>Mon, 23 Jun 2014 15:39:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/timespan-between-earliest-and-latest-per-day-per-user/m-p/115372#M30568</guid>
      <dc:creator>Unhacker</dc:creator>
      <dc:date>2014-06-23T15:39:46Z</dc:date>
    </item>
    <item>
      <title>Re: timespan between earliest and latest per day per user</title>
      <link>https://community.splunk.com/t5/Splunk-Search/timespan-between-earliest-and-latest-per-day-per-user/m-p/115373#M30569</link>
      <description>&lt;P&gt;The "&lt;EM&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.1.1/SearchReference/CommonStatsFunctions"&gt;range&lt;/A&gt;&lt;/EM&gt;" command should give you the difference between the earliest and latest times.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=juniper | stats min(time), max(time), range(time) BY user,date_wday
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 23 Jun 2014 18:14:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/timespan-between-earliest-and-latest-per-day-per-user/m-p/115373#M30569</guid>
      <dc:creator>mike_lebrun</dc:creator>
      <dc:date>2014-06-23T18:14:02Z</dc:date>
    </item>
  </channel>
</rss>

