Problem/Motivation

Logs are not cleaned so table size became too large,

Steps to reproduce

Check many fields to be logged for change and see the table size.

Proposed resolution

Provide config to clean old logs periodically on cron run.

Issue fork entity_log-3172389

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

mhmd created an issue. See original summary.

mhmd’s picture

Issue summary: View changes
mhmd’s picture

StatusFileSize
new3.53 KB

Patch for the feature

davit.magaldadze’s picture

StatusFileSize
new3.51 KB

Modified the patch to use entity_type.bundle.info service to load bundle info and fix a excute type in the cron hook.

igor.barato’s picture

Component: User interface » Code
Status: Active » Needs review
Related issues: +#3085171: Admin screen not respecting permission?
StatusFileSize
new3.19 KB

I updated the patch to remove entity_log.routing.yml permission fix in favor of this separate issue #3085171

igor.barato’s picture

StatusFileSize
new3.13 KB

Updated delete query to work with updated entity columns.

jcnventura’s picture

Status: Needs review » Needs work

The code in hook_cron() should be moved to the new cleanLogs() method, so that the entirety of the hook_cron is:

/**
 * Implements hook_cron().
 */
function entity_log_cron() {
  \Drupal::service('entity_log')->cleanLogs();
}

Also, it should use PDO methods to create the delete query and not raw SQL that will probably not work on non-SQL Drupal sites.

jcnventura’s picture

Assigned: mhmd » Unassigned
missvengerberg’s picture

Made a patch to delete rows from entity_log table based only on limit of rows, instead of bundles.

MilosR made their first commit to this issue’s fork.

milosr’s picture

Status: Needs work » Reviewed & tested by the community

  • jcnventura committed cdf58510 on 8.x-1.x authored by MilosR
    Issue #3172389 by igorbarato, MilosR, missvengerberg, davit.magaldadze,...
jcnventura’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.