No Data found in prefix_log table

No Data found in prefix_log table

by Tim Fang -
Number of replies: 3

Hi


I was trying to do the following query but it does not have any record on  table  prefix_log, 

and then i tried 'select * from prefix_log' and there is nothing on prefix_log, does anyone know what is it happen like that? how can I fix it? the system should record logs somewhere...


//


Total activity per course, per unique user on the last 24h

SELECT
     COUNT(DISTINCT userid) AS countUsers
   , COUNT(course) AS countVisits
   , concat('<a target="_new" href="%%WWWROOT%%/course/view.php?id=',c.id,'">',c.fullname,'</a>') AS Course
 
 FROM prefix_log AS l
 JOIN prefix_course AS c ON c.id = l.course
 WHERE course > 0 AND FROM_UNIXTIME(TIME) >= DATE_SUB(NOW(), INTERVAL 1 DAY) AND c.fullname LIKE '%תשעג%'
 GROUP BY course
ORDER BY countVisits DESC

Average of ratings: -
In reply to Tim Fang

Re: No Data found in prefix_log table

by Séverin Terrier -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators

Hi,

the important question is : where did you launched your query?

Because the "prefix_" element is only useful when using dedicated reports plugins like Ad-hoc database queries or Configurable Reports.

Otherwise, if you use Adminer or a direct SQL access, you should replace "prefix_" by "mdl_" or the prefix you defined in your config.php file.

HTH,
Séverin

In reply to Séverin Terrier

Re: No Data found in prefix_log table

by Tim Fang -

i tried

select * from mdl_log   ,  it has error , table does not exist. I used manage report from the dashboard.


Do you know what is going on ?

In reply to Tim Fang

Re: No Data found in prefix_log table

by Elizabeth Dalton -

Which version of Moodle are you using? After Moodle 2.7, the log method was changed, and newer systems are likely using the table prefix_logstore_standard_log instead. For examples of the changes needed to use the new log table, see

https://docs.moodle.org/33/en/ad-hoc_contributed_reports#Weekly_Instructor_Online_Participation

Best regards,

Elizabeth Dalton