Skip to content

Commit

Permalink
update log format to make it easier to query for in cloud watch
Browse files Browse the repository at this point in the history
  • Loading branch information
maidul98 committed Jan 31, 2024
1 parent 4b3e4f6 commit cb27cfd
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions backend/src/ee/services/audit-log/audit-log-queue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export const auditLogQueueServiceFactory = ({

const plan = await licenseService.getPlan(orgId);
const ttl = plan.auditLogsRetentionDays * MS_IN_DAY;
// skip inserting if audit log retension is 0 meaning its not supported
// skip inserting if audit log retention is 0 meaning its not supported
if (ttl === 0) return;
await auditLogDAL.create({
actor: actor.type,
Expand All @@ -61,12 +61,9 @@ export const auditLogQueueServiceFactory = ({
});

queueService.start(QueueName.AuditLogPrune, async () => {
logger.info("Started audit log pruning");
logger.info(`${QueueName.AuditLogPrune}: queue task started`);
await auditLogDAL.pruneAuditLog();
// calculate next utc time delay
// const nextPruneTime = getTimeDiffForNextAuditLogPrune();
// await queueService.stopJobById(QueueName.AuditLogPrune, "audit-log-prune");
logger.info("Finished audit log pruning");
logger.info(`${QueueName.AuditLogPrune}: queue task competed`);
});

// we do a repeat cron job in utc timezone at 12 Midnight each day
Expand All @@ -86,9 +83,8 @@ export const auditLogQueueServiceFactory = ({
});
};

queueService.listen(QueueName.AuditLogPrune, "error", (err) => {
logger.error("Audit log pruning failed");
logger.error(err);
queueService.listen(QueueName.AuditLogPrune, "failed", (err) => {
logger.error(err?.failedReason, `${QueueName.AuditLogPrune}: log pruning failed`);
});

return {
Expand Down

0 comments on commit cb27cfd

Please sign in to comment.