500 server error when trying to download logs?

500 server error when trying to download logs?

by Dan Jackson -
Number of replies: 4

I'm trying to download a CSV of log files relating to Guest User access in a particular course area, but no matter what format I select, I am getting an HTTP 500 server error when I click the Download button.

Enabling debugging error messages I get:


Notice: Trying to get property of non-object in /var/www/moodle/course/format/flexsections/lib.php on line 99

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 8208 bytes) in /var/www/moodle/admin/tool/log/store/standard/classes/log/store.php on line 123

Is there any way I could get around this restriction, for example by querying the database directly?

Thanks,

Dan Jackson (Lead ITServices Technician)

Long Road Sixth Form College

Cambridge, UK.

Average of ratings: -
In reply to Dan Jackson

Re: 500 server error when trying to download logs?

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

This is a long running problem... the data structure is loaded into memory before being exported and you can easily exceed memory limits. 

You could have a go at accessing the data directly. The table you want is mdl_logstore_standard_log.  You'll need to work out the 'contextid' of your course and filter on that field. Look in mdl_context where instanceid = the id of your course. If there's more than one, it's the one with contextlevel=50. When you've found it the 'id' field is the one you want for 'contextid'. 


In reply to Howard Miller

Re: 500 server error when trying to download logs?

by Dan Jackson -

I was actually able to get around this by using the Moodle Adminer plugin to export the results of a database query on mdl_logstore_standard_log in semicolon-separated values format (using CSV resulted in the same issue as trying to export CSV from the ordinary Moodle logs page).

Thanks,

Dan Jackson (Lead ITServices Technician).

In reply to Dan Jackson

Re: 500 server error when trying to download logs?

by Dan Jackson -

Just to give a bit more detail, here's the steps which we are doing, and we've also found something that succeeds where previously it failed:


1. We're logging on to our Moodle site and navigating to a course called The Hub 2016 - 2017, which all our 2016-entry students should be using fairly regularly.

2. In the Course administration area we're clicking Logs, then selecting the 2016 Entry group from the groups dropdown, and clicking Get these logs.


Leaving the actions dropdown set to "All actions" gives 981 pages of results, which results in an HTTP 500 error when trying to download as CSV.

However, changing the actions dropdown to "View" gives 825 pages of results, which can be downloaded successfully to a 16.8MB CSV file.

In reply to Dan Jackson

Re: 500 server error when trying to download logs?

by Dan Jackson -

Our Moodle support contractor increased the memory limit in php.ini from 128MB to 512MB and that has solved this issue (we are no longer getting the HTTP 500 errors).

Dan Jackson (Lead ITServices Technician).