5

civicrm_job_log is the biggest table in my database by an order of magnitude. And civicrm_log is the fifth biggest.

Can I trim these somehow, e.g. a cron job that removes old logs? It's making the backups slow.

EDIT: Here's an extension that keeps the job log from bloating

Thanks to the input here, I've created the Log Lop extension that allows users to configure a maximum age for keeping job logs. Will submit to the extensions directory after a bit more testing/few more eyes have looked at it.

4

I think you can safely trim the civicrm_job_log, only the latest entries are probably useful (and given how little information the cronjobs return, I'd even doubt that ;)

As for the civicrm_log (or subscription history), it might be more risky to remove as you will loose "useful" history of what happened with your contacts, but from a technical point of view, it shouldn't be an issue, as long as you are ok losing that history.

| improve this answer | |
  • Thanks, Xavier. Yeah I think I can live with not knowing that a record was changed some time in 2003, so I'll set up a cronjob to keep these tables trim. Many thanks. – artfulrobot Mar 8 '16 at 13:16
  • 3
    Would be awesome if you would write an extension that provides a browser interface (using the api) for that trimming, ideally with a param to set the cut off date (eg delete everything that is older than "delta" days ago) – Xavier Mar 8 '16 at 13:18
  • What if said extension "archived" the "useful" history from civicrm_log to a separate table, or .sql file? – G H Mar 8 '16 at 19:53
  • Is it safe to trim civicrm_log? Since it stores a change history, by removing some of the first rows you might be removing original values? – John Mar 9 '16 at 9:28
  • the latest version is always stored into the "real" entity (eg. civicrm_contact). The log mostly doesn't contain any data per se, only meta data (bob changed the contact on the 1st of april last year) – Xavier Mar 9 '16 at 9:48
0

Truncate civicrm_job_log as often as you like - the data is only of very very marginal interest and only for a short period

I usually prefer to turn on DB logging - in which case the data in the civicrm_log table doesn't really add anything - it's only a little bit useful IMHO anyway.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.