Keeping track of user activities in Strapi applications is possible with Strapi middleware. Developers can easily configure the Strapi application to log every action performed by each user, either through the admin dashboard or via API, into a custom collection type.
This is a companion discussion topic for the original entry at https://strapi.io/blog/how-to-use-lifecyle-hooks-for-audit-logs-in-strapi
Nice work with this article, if certainly fills in a few gaps on how this should be achieved in v4. One thing I noticed was the afterDelete hook did not include who did the actual deleting. I’d think that would be a very important piece of information to have, especially for an audit log! Is it possible to find the user that performed the delete action?
I’d also note that afterDelete is not called when the user clicks the check mark on the left side of the row, and then the delete button that pops up, but only when the user clicks the trash can icon on the right end of the item that is being deleted. To catch the other, you have to use the AfterDeleteMany lifecycle hook. That means in additon to the hooks used in this article, you probably also want to dcode for AfterDeleteMany, afterUpdateMany, and afterCreateMany to get full coverage
some minor mistakes in the document
if the Content Type is AuditLog, then the slug will be generated as audit-log, so
and also need async await
Hello, I’m just chiming in to say I would like this feature as well. I think it is very important to know who was the author/user who deleted an entry.
hi @sonya this feature is currently being developed per https://feedback.strapi.io/
AWESOME! Thanks for the quick response!