Trim down the log database size

Trim down the log database size

by eli chan -
Number of replies: 2

Morning, the size for database mdl_logstore_standard_log.ibd is about 3G and would like to delete all the logs. I tried to set "keep logs for two days" at

but the size still cannot trim down, please advise how to trim down the size.

Thanks a lot

Regards,

Eli Chan

Average of ratings: -
In reply to eli chan

Re: Trim down the log database size

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Did you run cron after changing that setting?

In reply to Tim Hunt

Re: Trim down the log database size

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

As Tim says the cron has to run to remove the rows from the log table.

However, the space isn't automatically recovered in the .ibd file.

You can run the MySQL statement OPTIMIZE TABLE mdl_logstore_standard_log to recover the space (assuming you have the mdl_ table prefix).

The log table will be locked during this operation so your site may be unresponsive whilst this runs (maybe a few minutes).

A database backup is recommended before any action such as this.