Depends on what you mean by “activity log”.
If you mean all the accessed routes, then you could use middleware that runs at the end and stores the logs.
module.exports = strapi => {
return {
// can also be async
initialize() {
strapi.app.use(async (ctx, next) => {
await next();
await strapi.config.functions['storeLogs'](ctx);
});
},
};
};
Where storeLogs is your custom function that accepts the ctx param and gets all the necessary data from it ( ctx.state.user - contains the information about logged in user, ctx.request.body - contains the body requests for POST/PUT etc.)
But if you mean the create/update/delete of some entities then you should use webhooks. Build an API that stores all the requests. Now you have an activity log for create/update/delete actions.