Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

Audit log: Optionally mute background jobs (internal actors). #42946

Merged
vrto merged 4 commits into
mainfrom
mv/auditlog/mute-background-jobs
Oct 18, 2022
Merged

Audit log: Optionally mute background jobs (internal actors). #42946
vrto merged 4 commits into
mainfrom
mv/auditlog/mute-background-jobs

Conversation

@vrto

@vrto vrto commented Oct 13, 2022

Copy link
Copy Markdown
Contributor

Description

Site admins can now optionally enable detailed (noisy) audit logs for the background jobs. For the sake of simplicity, any action that uses internal actor will be considered a "background job" in the audit log context.

log.auditLog.backgroundJobs = true/false

The default value is false.

This PR also refactors the auditLogEnabled logic, which has been repeated at a few places, and groups that logic into a single location, accessible via audit.IsEnabled(cfg, setting) function.

Test plan

  • Automated tests (both new, and refactored)
  • Manual testing, see the attached gifs for turning the audit logs on and off

…s to false.

Audit log: Add audit.IsEnabled function to avoid repeating the same logic.
@cla-bot cla-bot Bot added the cla-signed label Oct 13, 2022
@vrto vrto requested review from a team, bobheadxi, eseliger and mrnugget October 13, 2022 16:14
Comment thread internal/audit/audit.go
Comment on lines +22 to 25
// internal actors add a lot of noise to the audit log
if act.Internal && !IsEnabled(conf.SiteConfig(), BackgroundJobs) {
return
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIRC it's not just background jobs that uses internal actors right? Maybe InternalTraffic is a more apt "abstraction" for the configuration?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bobheadxi sure, happy to change it.

Comment thread CHANGELOG.md
Comment thread internal/audit/audit.go
@vrto vrto merged commit c699a72 into main Oct 18, 2022
@vrto vrto deleted the mv/auditlog/mute-background-jobs branch October 18, 2022 12:50
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants