<?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: Count number of users who logged in every hour for last 15 days in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Count-number-of-users-who-logged-in-every-hour-for-last-15-days/m-p/87095#M22259</link>
    <description>&lt;P&gt;info login | stats dc(userid) userCount by date_month date_mday date_hour date_year | &lt;BR /&gt;
eval outputdate = tostring(date_month) + "/" + tostring(date_mday)  + "/" + &lt;BR /&gt;
  tostring(date_year) | fields + outputDate date_hour userCount&lt;/P&gt;

&lt;P&gt;should do it&lt;/P&gt;</description>
    <pubDate>Mon, 28 Sep 2020 11:29:56 GMT</pubDate>
    <dc:creator>lguinn2</dc:creator>
    <dc:date>2020-09-28T11:29:56Z</dc:date>
    <item>
      <title>Count number of users who logged in every hour for last 15 days</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Count-number-of-users-who-logged-in-every-hour-for-last-15-days/m-p/87092#M22256</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;My log contains entries as shown below:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[2012-03-07 23:57:49:107 GMT+00:00][12321312332432545435435543.http-8080-35][com.myabc.myactions.myAction] INFO #login# useremail=myemail@hotmail.com userid=6367 
[2012-03-06 23:57:49:107 GMT+00:00][89237658745354353.http-8080-35][com.myabc.myactions.myAction] INFO #login# useremail=someoneemail@hotmail.com userid=8472
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I want to know how many users (basically userids) logged in every hour for last 15 days.&lt;BR /&gt;
For example: between 12 to 1, 15 users logged in, between 1 to 2, 0 users logged in, etc&lt;/P&gt;

&lt;P&gt;How can I get these numbers? Is there a way I can get this number to export it to excel?&lt;/P&gt;

&lt;P&gt;Appreciate any help!!&lt;/P&gt;</description>
      <pubDate>Thu, 08 Mar 2012 00:22:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Count-number-of-users-who-logged-in-every-hour-for-last-15-days/m-p/87092#M22256</guid>
      <dc:creator>freephoneid</dc:creator>
      <dc:date>2012-03-08T00:22:00Z</dc:date>
    </item>
    <item>
      <title>Re: Count number of users who logged in every hour for last 15 days</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Count-number-of-users-who-logged-in-every-hour-for-last-15-days/m-p/87093#M22257</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;info login | stats dc(userid) by date_month date_mday date_hour
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This counts how many unique userids appear in the log for each hour. However, a user is only counted in the hour that they logged in - in other words, if they logged in at 9:00 am and logged out at 5:00 pm, they are only counted in the 9:00 hour. (Assuming that this search only retrieves login events.) If a user logs in 3 times in one hour, he/she is only counted once for that hour.&lt;/P&gt;

&lt;P&gt;Once you run the search, click the export button and choose CSV format to output your results to a csv file on your desktop.&lt;/P&gt;

&lt;P&gt;If this isn't what you want, can you clarify what other events (like logout events, etc.) might also appear in the logs?&lt;/P&gt;</description>
      <pubDate>Thu, 08 Mar 2012 02:03:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Count-number-of-users-who-logged-in-every-hour-for-last-15-days/m-p/87093#M22257</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2012-03-08T02:03:13Z</dc:date>
    </item>
    <item>
      <title>Re: Count number of users who logged in every hour for last 15 days</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Count-number-of-users-who-logged-in-every-hour-for-last-15-days/m-p/87094#M22258</link>
      <description>&lt;P&gt;Thanks for the quick reply. Is there a way to produce the date in mm/dd/yyyy format in single column itself so that when I export it to csv, it'll show up in one column as mm/dd/yyyy?&lt;/P&gt;</description>
      <pubDate>Thu, 08 Mar 2012 18:46:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Count-number-of-users-who-logged-in-every-hour-for-last-15-days/m-p/87094#M22258</guid>
      <dc:creator>freephoneid</dc:creator>
      <dc:date>2012-03-08T18:46:02Z</dc:date>
    </item>
    <item>
      <title>Re: Count number of users who logged in every hour for last 15 days</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Count-number-of-users-who-logged-in-every-hour-for-last-15-days/m-p/87095#M22259</link>
      <description>&lt;P&gt;info login | stats dc(userid) userCount by date_month date_mday date_hour date_year | &lt;BR /&gt;
eval outputdate = tostring(date_month) + "/" + tostring(date_mday)  + "/" + &lt;BR /&gt;
  tostring(date_year) | fields + outputDate date_hour userCount&lt;/P&gt;

&lt;P&gt;should do it&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 11:29:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Count-number-of-users-who-logged-in-every-hour-for-last-15-days/m-p/87095#M22259</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2020-09-28T11:29:56Z</dc:date>
    </item>
    <item>
      <title>Re: Count number of users who logged in every hour for last 15 days</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Count-number-of-users-who-logged-in-every-hour-for-last-15-days/m-p/87096#M22260</link>
      <description>&lt;P&gt;Thanks again for quick reply. However, the outputdate is coming as march/3/null. Somehow, the year is coming null all the time &amp;amp; month is coming in words instead of numbers. Any clue?&lt;/P&gt;</description>
      <pubDate>Thu, 08 Mar 2012 21:16:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Count-number-of-users-who-logged-in-every-hour-for-last-15-days/m-p/87096#M22260</guid>
      <dc:creator>freephoneid</dc:creator>
      <dc:date>2012-03-08T21:16:34Z</dc:date>
    </item>
    <item>
      <title>Re: Count number of users who logged in every hour for last 15 days</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Count-number-of-users-who-logged-in-every-hour-for-last-15-days/m-p/87097#M22261</link>
      <description>&lt;P&gt;info login | &lt;BR /&gt;
stats dc(userid) as userCount latest(_time) by date_month date_mday date_hour  | &lt;BR /&gt;
eval outputDate = strftime(_time, "%m/%d/%Y") |&lt;BR /&gt;
fields + outputDate date_hour userCount&lt;/P&gt;

&lt;P&gt;should do better - and it's shorter too!&lt;/P&gt;

&lt;P&gt;Typo - outputDate is case-sensitive. Timechart, as Ayn points out, would be easier - I forgot that you can just show the data table from the timechart. This is what you want, not the actual graph.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 11:30:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Count-number-of-users-who-logged-in-every-hour-for-last-15-days/m-p/87097#M22261</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2020-09-28T11:30:04Z</dc:date>
    </item>
    <item>
      <title>Re: Count number of users who logged in every hour for last 15 days</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Count-number-of-users-who-logged-in-every-hour-for-last-15-days/m-p/87098#M22262</link>
      <description>&lt;P&gt;Timechart seems to be the easiest way to solve this.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | timechart span=1h dc(userid)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 08 Mar 2012 21:57:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Count-number-of-users-who-logged-in-every-hour-for-last-15-days/m-p/87098#M22262</guid>
      <dc:creator>Ayn</dc:creator>
      <dc:date>2012-03-08T21:57:08Z</dc:date>
    </item>
    <item>
      <title>Re: Count number of users who logged in every hour for last 15 days</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Count-number-of-users-who-logged-in-every-hour-for-last-15-days/m-p/87099#M22263</link>
      <description>&lt;P&gt;I tried this but its not showing any result under outputDate column. Is there anything missing in this query? the latest(_time) does not producing any result.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Mar 2012 22:31:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Count-number-of-users-who-logged-in-every-hour-for-last-15-days/m-p/87099#M22263</guid>
      <dc:creator>freephoneid</dc:creator>
      <dc:date>2012-03-08T22:31:05Z</dc:date>
    </item>
  </channel>
</rss>

