-
I like this package but after running for a little while on a moderately active database the activity_log table is about 10 times the size of the rest of the db. Anyone run across this and what are your thoughts to mitigate this? Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Hey, is your issue only about the size the table requires on the disk? Or do you have any performance issues on runtime? The package provides a command to delete all activities older than x days. |
Beta Was this translation helpful? Give feedback.
-
Yes and yes. We need to retain logging for audit purposes and truncating after certain number of days would defeat the purpose. |
Beta Was this translation helpful? Give feedback.
Hey,
is your issue only about the size the table requires on the disk? Or do you have any performance issues on runtime?
The package provides a command to delete all activities older than x days.
https://docs.spatie.be/laravel-activitylog/v3/basic-usage/cleaning-up-the-log/
If you need all logs forever but not in the database you could also adjust this command to export the activities in question as CSV and send via email or put in a storage before deleting.
You could use https://github.com/spatie/simple-excel to do this.