Jump to content

can i clean tbllog_register ?


Recommended Posts

i found 2 options here

DELETE FROM `tbllog_register` WHERE created_at < "2021-01-01";

Matched rows: 12158

DELETE FROM `tbllog_register` WHERE namespace = 'RunJobsQueue.executed'

Matched rows: 15586

 

Edited by lims
Fixed, only clean Queue
Link to comment
Share on other sites

  • 4 weeks later...
  • 11 months later...

@Dallin121 I created a gist of the solution I'm using based on @linux4me's solution in the above mention, but yeah just bear in mind that it'll delete the historical cron records. I don't really care about the cron records and I haven't noticed any other issues but it's possible I might regret it later, ha. Anyway, be sure to create a backup first.

Link to comment
Share on other sites

  • 4 months later...

Rather than a PHP script running with cron, you can use MySQL  scheduler as follows:

Enable scheduler:

SET GLOBAL event_scheduler = ON;

Create the event, we clear all events > 90 days:

CREATE EVENT `whmcs_prune_tbllog` ON SCHEDULE EVERY 1 DAY STARTS '2023-01-01 01:00:00' ON COMPLETION NOT PRESERVE ENABLE COMMENT 'Clear WHMCS tbllog_register over 90 days' DO DELETE FROM `tbllog_register` WHERE created_at <= ( CURDATE() - INTERVAL 90 DAY );

We also use a similar schedule for tblactivitylog:

CREATE EVENT `whmcs_prune_tblactivitylog` ON SCHEDULE EVERY 1 DAY STARTS '2023-01-01 01:05:00' ON COMPLETION NOT PRESERVE ENABLE COMMENT 'Clear WHMCS tblactivitylog over 90 days' DO DELETE FROM `tblactivitylog` WHERE date <= ( CURDATE() - INTERVAL 90 DAY );

Verify your events with:

SHOW EVENTS;
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated