-
-
Notifications
You must be signed in to change notification settings - Fork 729
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Log who deleted products (and other records) #12452
Comments
Thanks Mohamed! I've merged but will keep this open as it doesn't yet cover the new products_v3 screen. Here are some suggestions for next steps, what do you think?
|
What is the problem we are solving
While investigating this issue, we found it would be super helpful if we had a log of who deleted certain products.
Products in our system are never fully deleted, only soft-deleted.
We do currently log delete actions like this for example (in
apps/openfoodnetwork/current/log/production.log
):But this only contains an IP address, which is not very helpful for determining who did it.
Also, it's possible some other actions could cause delete of a product (I haven't checked, but I can imagine delete of an enterprise would also result in products deleted).
Also, currently we don't have any guarantees of how long these logs are available on the server, and could be cleared after only a couple of days.
Success factors = expected outcome
At least a dev could find out who deleted a product.
Suggested solution
It was proposed in #12431 (comment) that saving to a log file is the best way to manage this. It could be added to the main log file, but I suggest a separate log.
This would be complemented by:
We can probably add an ActiveRecord hook somewhere to catch most deletes of any record. It's a bit of extra work to track the user ID, but I think do-able (see proof of concept in PR), we could add to products to begin with.
The text was updated successfully, but these errors were encountered: