Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.

Is it safe to delete all eventlog directly from database?

+1 vote
102 views
asked Sep 30 in Q2A Core by kksal55
Is it safe to delete all eventlog directly from database?

My qa_eventlog table size is 1 gb. Do I have a problem if I empty the table?
Q2A version: 1.8

1 Answer

+3 votes
answered Sep 30 by pupi1985
selected Oct 3 by kksal55
 
Best answer

In terms of the core alone, it is. I mean, the core doesn't use that table for reading, it uses it only for writing. The idea of the table is that you can use it to perform some low level audit and nothing more. That's why the core will not be affected by removing all the records in the table (which can be done by truncating the table).

The thing is that maybe you have installed some plugins that depend on that table and read information from it. So maybe if you remove information from the table you might generate an inconsistency. For example, the On-site Notifications plugin takes the notifications from there. This means that if you remove the data you will lose the notifications. New notifications will show up again, but the old ones will be gone.

In order to be 100% sure that nothing will break you should check each of the custom plugins you've installed and make sure they don't query that table. If they do and the only issue is that you will lose some data (as with the On-site Notifications plugin) maybe you can erase all data except the X latest days, instead of truncating the whole table. In order to do so you can run the following query (in this case keeping the latest 60 days' information):

DELETE FROM `qa_eventlog`
WHERE `datetime` < CURDATE() - INTERVAL 60 DAY

Disclaimer: if something breaks after running this query, remember you where the one who listened to random people from the internet :P

commented Sep 30 by kksal55
Thank you very much for your reply.
commented Oct 1 by TeresaMBrashear
oh, thank you! i had the same problem too !
commented Oct 1 by pupi1985
Hi @TeresaMBrashear. What was the size of your database?
...