What happens if we change the loglifetime setting?

What happens if we change the loglifetime setting?

by Diane Soini -
Number of replies: 8

Testing this is difficult because it requires a great deal of time to set up the test, so I'm asking in case anyone has institutional experience on this.

We have the loglifetime setting set to Never (/admin/settings.php?section=logsettingstandard). We would like to change this setting. Our logstore_standard_log table has approximately 688,472,030 rows. The concern is that the first time it goes to prune this database, the query will lock up the whole site for days.

Does anyone have any experience with this and can offer any suggestions as to the best way to go about turning on the pruning functionality.

Average of ratings: Useful (1)
In reply to Diane Soini

Re: What happens if we change the loglifetime setting?

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

For what i know, if you change the setting from "Never" to another value, the logstore_standard\task\cleanup_task task will then delete from database all lines having a timecreated value older than now minus the defined time to keep logs.

What you can perhaps do is :
- making sure logstore_standard\task\cleanup_task is set at a time where nearly nobody uses Moodle
- manually delete old(er) lines in mdl_logstore_standard_log, defining timecreated value as you want, and doing it in several occurrences, changing timecreated value each time.

Sorry not to provide better information ; hope this helps,
Séverin
In reply to Séverin Terrier

Re: Re: What happens if we change the loglifetime setting?

by Diane Soini -
Yeah, what I'm wondering is if it has to delete 600 million rows is it going to lock everything up. There really is no period of time that students are not using our system.
In reply to Diane Soini

Re: What happens if we change the loglifetime setting?

by Luis de Vasconcelos -
Do you have a Moodle Dev or Test site that is a copy of your Moodle Production site? If so, try changing the loglifetime setting on that Dev/Test site and see what happens. If it does lock Moodle up at least it wont affect your students on the production site.
In reply to Luis de Vasconcelos

Re: What happens if we change the loglifetime setting?

by Diane Soini -

I was hoping to avoid doing that because to restore the data takes several hours. I was hoping someone who has done this with millions of records could share their experience.

In reply to Diane Soini

Re: What happens if we change the loglifetime setting?

by Yaron Helfer -

Hi everyone, 

yesterday we tried changing the log life time from never to a new value and the scheduled task ran overnight. This morning we found out that we're still having old data in the table. 

After a short check we found out that the scheduled task has duration limitation for 5 minutes as a safety rule to avoid throttling the scheduled task manager (aka. Cron) with a long term job. As far as I know this job will keep running everyday for 5 minutes until it cleans everything. Hundreds of millions of rows might take a several weeks to be deleted. 

If you want to delete all the old data at once you can alternatively run a manual sql query for deletion while Moodle's maintenance mode is on, it might take a long time to be done.

Average of ratings: Useful (3)
In reply to Yaron Helfer

Re: What happens if we change the loglifetime setting?

by Rex Lorenzo -

You should be able to go to Site administration > ServerTasks > Task processing and set the following settings:

  • Scheduled task runner lifetime
  • Ad hoc task runner lifetime

To a longer time. But the default for scheduled task length is not 5 minutes, but 30 minutes. Maybe some other admin changed the default?

Average of ratings: Useful (3)
In reply to Rex Lorenzo

Plugin Problem

by SSAI Institute of LMS -

Error! version 3.5 is required and you are running 3.9.1 (Build: 20200713)

Error! current version needed mysql (5.5.5-10.0.38-MariaDB-cll-lve), 

Our current version is 10.5

Apache 7.4

We have installed this plugin twice in fresh implementation with the latest version of Moddle 3.9x and MariaDB and in both occasions is has crashed our installations.  It tries to replace the current Moodle version for some reason, and it also tries to convert the MariaDB.  Which is odd because, it should not touch those installs, since they are uptodate.

Can you provide some detail clarifications on why your plugin changes the admin cli, we were able to access portions of moodle including the plugin page and were able to uninstall the plugin, however the uninstall look like a simple directory scrub, and it does not seem to return the files to the original version.  

Any ideas why this behavior is happening?

Why Would it let us uninstall the plugin but persist the error created by the plugin installation?

Its not a cache problem, and also the object is not persisting in memory since we place a trace on the objects created by the plugin, anyhow,  if you can think of a fix let me know, we tried everything in the forums and it does not work for us.  We really appreciate any assistance and if we find the solution we will contribute it to the community as an update.   My email is rgarcia@ssai.inistitue if you want to send me a reply directly.