Audit log grows infinitly
As you said before, the audit log keeps growing and has no automatic maintenance. Adding an automatic removal of logs older than X days (30, 60, ...) could be a nice addition. Can probably add this in my own cronjobs too
Just wanted to write it down somewhere x)
@AIC-BV just to double check, did you purchase a license for this plugin? 😉
I think I'll start adding the usernames that have paid to the license file to keep track for now until we finish the marketplace and then I'll move license management to there instead.
Yes you know I did it using Paypal x)
That's what I thought, I just couldn't remember for sure, hence why I need to start logging the purchases 😂
Added a cron to clean it up
use LukeTowers\EasyAudit\Models\Activity as ActivityLog;
$schedule->call(function() {
// get all activity logs older than three months
$logs = ActivityLog::select('id')
->whereDate('created_at', '<=', Carbon::now()->subMonths(3))
->get();
// delete each log
$amount = 0;
foreach ($logs as $log) {
$amount++;
$log->delete();
}
trace_log('--- 1st day of the month at 5:00 AM: Deleted ' . $amount . ' items. (Activity Logs)');
})->timezone('Europe/Brussels')->cron('0 5 1 * *');
@AIC-BV 🫨
I'm just waiting on https://github.com/wintercms/winter/pull/1263 to be finished and then there will be a much nicer solution