Online Live Users - Report

Online Live Users - Report

by Nitesh Duhan -
Number of replies: 2

Is there any report in Moodle, where I can see "online live users" for a period? I need a line graph:

Y axis- Number of online live users

X axis- From Jan 2022 to Sep 2024

Just like we see share price line graph.

Average of ratings: -
In reply to Nitesh Duhan

Re: Online Live Users - Report

by Rick Jerz -
Picture of Particularly helpful Moodlers Picture of Testers
You could always use custom SQL to access the data. I don't know if Moodle has a report for this purpose, but others here on Moodle.org might reply. You might want to mention the version of Moodle you are using.

Also, consider providing your definition of "online live users." Do you mean "logged in at least once within a day, month, or year?"  Also, what do you mean by "online?"  Are you suggesting online courses versus face-to-face?  And I am a little puzzled by "live."  Aren't all students "alive?"  Do you have "dead" students taking course, such as machines?  Do you want to include only students?  Teachers?  Administrators?
 
Consider exploring List of SQL Contributed reports for examples.
 
I believe every "login" is captured in the mdl_logstore_standard_log table.
 
As a starting point, below is my custom SQL that shows me who was logged in during the last 60 minutes.
 
 
 

# Shows users logged in the last 60 minutes.
#   I wonder if it would be helpful to show the course that the student is in?
# Modified 1/15/20 with an attempt to fix problems around midnight.  It should now work.


SELECT firstname,
       lastname,
       from_unixtime(lastaccess) AS LastClick,
       timediff(now(), from_unixtime(lastaccess)) AS lastaccess,
       timestampdiff(MINUTE, from_unixtime(lastaccess), now()) AS minutes_ago
FROM prefix_user HAVING minutes_ago < 60
order by lastaccess

Average of ratings: Useful (1)
In reply to Nitesh Duhan

Re: Online Live Users - Report

by Brett Dalton -
Picture of Moodle HQ Picture of Particularly helpful Moodlers
You are probably better off using your web server logs for this type of information that the Moodle database. It will be more accurate and easier to deal with. Many APM system can extract this from standard Apache or nginx logs with little effort