LDAP Sync Scheduled Task produces crippling logs

LDAP Sync Scheduled Task produces crippling logs

by James Snell -
Number of replies: 2

My Moodle server's been gradually updated for years. 99% of my 5300 user accounts are authenticated via LDAP. I'm currently running 3.3+ (20170525)

When the Scheduled Task "LDAP users sync job" runs, an entry for each user is added to my logstore_standard_log table. I run this scheduled task every 10mins. The result is that my logstore_standard_log table is about 60GB. It's garbage records I do not want stored and it slightly complicates my backups.

Moodle seems mature and this doesn't feel like an advanced use case, so there must be a clean way to prevent cli actions from being logged?

Here's a sample of the records in my logstore_standard_log:

Example CLI records in logstore_standard_log

If I can't find a clean solution, then I may craft a cron job that'll just purge those records periodically. I hate that solution though. Please help.

Average of ratings: -
In reply to James Snell

Re: LDAP Sync Scheduled Task produces crippling logs

by Leon Stringer -
Picture of Core developers Picture of Particularly helpful Moodlers

Yes, this doesn't seem great does it. I think this behaviour was introduced between Moodle 2.9.0 and 2.9.1 for MDL-49022.

For now the things you could do to alleviate this are:

  1. Configure the sync scheduled task to occur less frequently.
  2. Reduce the Keep logs for setting to reduce the size of mdl_logstore_standard_log.

I realise these are both poor workarounds and may not be possible for your environment.

Longer term I guess the fix would be to compare all the user attributes being synced and only call user_update_user() if any have changed.

I think it should be fixed as apart from causing the problems you've mentioned it makes the logs hard to use in troubleshooting any issues, and it also means that you can't use them to tell if any users were updated, i.e. if five of 5,300 accounts had attributes changed, it would be useful to see that, rather than 5,300 "User updated" entries which isn't really useful at all.