How to import old log backup

How to import old log backup

by Dave Weninger -
Number of replies: 2

Our moodle is version 3.6.1, CentOS 7.4, MySQL 5.7.21

We set Moodle to keep log for 35days. We have backup for the old log file regularly.

Recently, a teacher requests to check log older than 35days to prove if the student had submitted assignment or not. We want to restore old log file backup. However, we cannot find any function at Moodle to import the old log backup record.

Please advise how to import the old log backup. Thank you very much.

Best Regards,

Kelvin Ma

Average of ratings: -
In reply to Dave Weninger

Re: How to import old log backup

by Ken Task -
Picture of Particularly helpful Moodlers

First and foremost, do not ... repeat do not import into existing DB or tables for active moodle.

Top of head suggestion ... no gui cause no php files/program to do this, but you as the admin could produce txt file 'reports' for 'proof'.

Find out the date of the assignment was to be submitted (ball park at least).

Take a backup you have of your moodle site that includes that date, and import mdl_user and mdl_logstore_standard_log (maybe mdl_assign_submission) into a new DB - call it 'investigation'.

Using mysql client as super user, use 'investigation' DB and do a CLI query
of mdl_user table for the students ID number exported to a student.txt file.

Use the student id number for another CLI query of the investigation:mdl_log_store_standard_log for student id (column userid) contained in mdl_users to an actions.txt file.

That should render all recorded actions of the student to actions.txt.

Search actions.txt for assignment submissons ... the last columns in that table are epoch time stamps and one could use fgrep to find specific dates by epoch time stamp.

For the specifics on how to create new DB, import only certain tables, and then using mysql client as super user to create the text file reports is for you, the admin, to research/do. smile

And a thought ... If this is done once, it will be asked again ... especially if word gets round .... and it will ... student 'won the disagreement' and as a result grade was improved.   Might be worth $ to build something GUI for it.

Above, of course, probably isn't the only way and it could be some developer out in moodle la-la land has developed something that does what seek.  Above is a 'poor man's approach' and off top of a feeble mind ... sooooo! smile

'SoS', Ken

Average of ratings: Useful (2)
In reply to Ken Task

Re: How to import old log backup

by Thorsten Bartel -
Picture of Core developers
+1 to Ken

However regarding this part:
"And a thought ... If this is done once, it will be asked again ... especially if word gets round .... and it will ... student 'won the disagreement' and as a result grade was improved. Might be worth $ to build something GUI for it."

In my experience the student never wins those discussions, as in most cases the claim is just a lazy attempt to circumvent a missed deadline.
If this is going to be asked on a regular basis with prospect of success, something more sinister is going on (losing submissions) and I would prioritize fixing that issue above building a GUI. smile