Counting User Logins

Counting User Logins

by Otaku Dude -
Number of replies: 0

Hiya,

I have been using the Statistics report to look at logins to our Moodle. I set the time period and Report Type to Logins. The number of Logins seems very high to me. When I run the following SQL query a colleague wrote I get significantly less logins reported. The query looks at usernames and I can change between Staff and students by changing the u.username (staff have alphabetical, students numerical)

SELECT COUNT(u.id), u.username, u.firstname, u.lastname

FROM mdl_logstore_standard_log l

INNER JOIN mdl_user u ON u.id = l.userid

WHERE l.component = 'core' AND l.action = 'loggedin' AND u.username REGEXP '^[a-z]+$'

AND FROM_UNIXTIME(l.timecreated, '%Y%m%d') >= 20190801 AND FROM_UNIXTIME(l.timecreated, '%Y%m%d') <= 20190831

GROUP BY u.username


Is this query OK? Is there a definative way to get this info?


Many thanks,

Nige.

Average of ratings: -