<?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 How to count min max time by user? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-min-max-time-by-user/m-p/490200#M136911</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I am trying to pull min and max time for each user:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="iptv_rdkb" [|inputlookup usersfile.csv]
| fields _time Source device.make model userId
| stats count by Source make model userId _time
| eventstats max(_time) AS max min(_time) AS min
| eval max=strftime(max, "%Y/%m/%d %T.%3Q")
| eval min=strftime(min, "%Y/%m/%d %T.%3Q")
| stats earliest(min) as min earliest(max) as max first(make) as make first(model) as model first(userId) as user by userId
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Results:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Source min max make model userid
b661834 2020-04-10 2020/04/10 TECHN xyz 1
b654623 2020-04-10 2020/04/10 TECHN xyz 2
b637895 2020-04-10 2020/04/10 TECHN xyz 3
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This search gives me the same time for each record. For example, if minimum time is 2020-04-10 in any of the records, it will give this date/time in every record instead of giving min-max of that specific user.&lt;/P&gt;

&lt;P&gt;I need min and max for each specific user.&lt;/P&gt;

&lt;P&gt;Please help.&lt;/P&gt;</description>
    <pubDate>Sat, 02 May 2020 18:03:07 GMT</pubDate>
    <dc:creator>t874560</dc:creator>
    <dc:date>2020-05-02T18:03:07Z</dc:date>
    <item>
      <title>How to count min max time by user?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-min-max-time-by-user/m-p/490200#M136911</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I am trying to pull min and max time for each user:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="iptv_rdkb" [|inputlookup usersfile.csv]
| fields _time Source device.make model userId
| stats count by Source make model userId _time
| eventstats max(_time) AS max min(_time) AS min
| eval max=strftime(max, "%Y/%m/%d %T.%3Q")
| eval min=strftime(min, "%Y/%m/%d %T.%3Q")
| stats earliest(min) as min earliest(max) as max first(make) as make first(model) as model first(userId) as user by userId
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Results:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Source min max make model userid
b661834 2020-04-10 2020/04/10 TECHN xyz 1
b654623 2020-04-10 2020/04/10 TECHN xyz 2
b637895 2020-04-10 2020/04/10 TECHN xyz 3
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This search gives me the same time for each record. For example, if minimum time is 2020-04-10 in any of the records, it will give this date/time in every record instead of giving min-max of that specific user.&lt;/P&gt;

&lt;P&gt;I need min and max for each specific user.&lt;/P&gt;

&lt;P&gt;Please help.&lt;/P&gt;</description>
      <pubDate>Sat, 02 May 2020 18:03:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-count-min-max-time-by-user/m-p/490200#M136911</guid>
      <dc:creator>t874560</dc:creator>
      <dc:date>2020-05-02T18:03:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to count min max time by user?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-min-max-time-by-user/m-p/490201#M136912</link>
      <description>&lt;P&gt;&lt;CODE&gt;eventstats&lt;/CODE&gt; can use &lt;CODE&gt;by&lt;/CODE&gt; clause.&lt;/P&gt;</description>
      <pubDate>Sun, 03 May 2020 03:53:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-count-min-max-time-by-user/m-p/490201#M136912</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-05-03T03:53:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to count min max time by user?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-min-max-time-by-user/m-p/490202#M136913</link>
      <description>&lt;P&gt;@t874560  Use this search &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index="iptv_rdkb" [|inputlookup usersfile.csv]
 | fields _time Source device.make model userId
 | stats count by Source make model userId _time
 | eventstats max(_time) AS max min(_time) AS min by userId
 | eval max=strftime(max, "%Y/%m/%d %T.%3Q")
 | eval min=strftime(min, "%Y/%m/%d %T.%3Q")
 | stats earliest(min) as min earliest(max) as max first(make) as make first(model) as model first(userId) as user by userId
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 05 May 2020 23:27:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-count-min-max-time-by-user/m-p/490202#M136913</guid>
      <dc:creator>Vijeta</dc:creator>
      <dc:date>2020-05-05T23:27:04Z</dc:date>
    </item>
  </channel>
</rss>

