Support » Plugin: Simple History – user activity log, audit tool » simple_history_contexts table grows indefinitely to a gigantic size

  • Resolved rklrkl

    (@rklrkl)


    The simple_history_contexts table appears to grow indefinitely and isn’t regularly pruned w.r.t. the current log retention period (60 days by default).

    It unfortunately doesn’t have a date field, so some slightly more complex SQL would be needed to cross reference the history_id with the id entries in the wp_simple_history table to get the date and decide whether a simple_history_contexts table entry needs removing or not.

    Yes, I know the Settings -> Simple History -> Clear log now button will remove all the entries from both the wp_simple_history and wp_simple_history_contexts tables, but a) that is a manual process and b) we would lose (I believe) the last 60 days of log entries doing that.

    It should be noted that a busy site we’d been running for a few years with Simple History and had never clicked on “Clear log now” button had managed to accumulate 111 million (!) rows in the wp_simple_history_contexts table and the wp_simple_history_contexts.ibd file was a horrendous 37GB for that single table!

    Hence, I’m requesting that new code is added so that the entries older than the current log retention period (60 days by default) are removed from the wp_simple_history_contexts table at the same time that old entries in the wp_simple_history table are removed.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author eskapism

    (@eskapism)

    Thanks for the bug report. I know that the log can grow large if you have a large amount of logged entries, for example a huge amount of login attempts due to for example bruce force attacks. Do you have a large number of logged events? And is old events purged every 60 days or have you overridden this?

    When the log is cleared is should also clear the context table, so it’s strange if that table is so large but the other is not…

    Thread Starter rklrkl

    (@rklrkl)

    We haven’t filtered any of the logging or changed the default 60 day expiry period. We had to click on “Clear log now” 2 days ago to reset the tables (which brought their .ibd sizes down to 128K each).

    2 days on, wp_simple_history has 150,000 rows and simple_history_contexts has 1.35 million rows! There’s over 8,000 WordPress users in the DB and most of those login every weekday – it’s a very busy site as I said and I’m not seeing a lot of failed logins in the tables either.

    I think what’s needed is some control over what is actually logged – I’m seeing a lot of entries related to valid logins which I’m not that interested in and would like to disable logging for (because it doesn’t change the site). I sent in a feature request about that last year:

    https://github.com/bonny/WordPress-Simple-History/issues/204

    Having control over what Simple History logs would allow us to filter out stuff we’re not interested in and reduce the size of the DB tables. It still concerns me that we’re seeing over 600,000 DB entries added to the simple_history_contexts table in a single day, which is somewhat “bonkers”.

    i’m also noticing this on a website that’s not super busy, and not a huge number of logged events, but the db table has over 1 million rows.

    Plugin Author eskapism

    (@eskapism)

    @bronw3n I sounds really strange that the db table has so many rows even if there are little activity. Any chance you could go to “Settings –> Simple History –> Debug” and see what logger that has logged all those rows?

    Plugin Author eskapism

    (@eskapism)

    @rklrkl thanks for the follow up. I haven’t used the plugin myself on a site with that many users but I do understand that an options to better control what messages are logged would be very useful. Thanks for the issue, hopefully I will find the time to do something similar in the future.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘simple_history_contexts table grows indefinitely to a gigantic size’ is closed to new replies.