Support » Plugin: iThemes Security (formerly Better WP Security) » Database Logs not clearing

  • asw


    Using iThemes Security v 4.9.2. I have Days to Keep Database Logs set to 4 but the old logs are not clearing out. There are logs over a month old. This is causing my db to grow quite large.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Simply add the line below to your wp-config.php file:

    define('ITSEC_USE_CRON', true);

    Wait for a little more than a day and then deactivate, activate the plugin. This should reset the plugin hooking into WP Cron.

    Setting ITSEC_USE_CRON to true in the wp-config.php file is MANDATORY for the plugin to properly hook into WP Cron. However it’s poorly documented.

    • This reply was modified 2 years, 7 months ago by nlpro.


    appreciate the piece of the puzzle nlpro (@nlpro)




    You can also use this plug-in. Works!!

    Thank you so much @nlpro – I’ve got iThemes running on a few sites and the logs are getting ridiculous! The Global Settings page gives no indication that anything is needed to make this feature work. If I’d realised this, I’d have used ‘file only’ for log storage, rather than filling up the database.

    You are welcome.

    There is a bunch of recent changes to the plugin that contribute to the logs growth:

    • The logging code has completely been rewritten. As a result of this more events are logged.
    • The scheduling code has completely been rewritten.
    • The code of the File Change Detection module scan engine has completely been rewritten.
    • The plugin previously kept only the last 14 days of log data (by default). That changed to the last 60 days (+300%).

    On top of this iThemes decided to remove the Clear Logs button from the Logs page.

    With so much code being rewritten in a short period of time it’s inevitable that bugs are introduced. iThemes is actively fixing many bugs. However the one you ran into has not yet appeared on their radar. Luckily for us there is a simple solution. I must add that the clear logs bug is more likely to happen in an env with less frequent http requests (like a test or development env).

    Anyway setting the ITSEC_USE_CRON constant to true ensures 3 vital maintenance cron jobs are properly scheduled and gives you back control over your database 😉

    • This reply was modified 2 years, 5 months ago by nlpro.
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Database Logs not clearing’ is closed to new replies.