Skip to content
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

Monolog processor to put UID in log messages #19175

Closed
1 task done
Tracked by #19300 ...
timcosgrove opened this issue Sep 10, 2024 · 2 comments · Fixed by #19338
Closed
1 task done
Tracked by #19300 ...

Monolog processor to put UID in log messages #19175

timcosgrove opened this issue Sep 10, 2024 · 2 comments · Fixed by #19338
Assignees
Labels
CMS Team CMS Product team that manages both editor exp and devops

Comments

@timcosgrove
Copy link
Contributor

timcosgrove commented Sep 10, 2024

User Story or Problem Statement

In #19156, we removed Monolog's current_user processor, which was writing both uid and username information to log messages. username is PII, but uid is not. It is useful to be able to tie a log message back to the user whose actions resulted in the log message, so we should re-enable uid.

Description or Additional Context

The 'current_user' processor Monolog provides is here: https://git.drupalcode.org/project/monolog/-/blob/3.0.x/src/Logger/Processor/CurrentUserProcessor.php?ref_type=heads

This can almost certainly be used as a starting part for what we want. We specifically do not want to write email, username, or any other personally identifying information to the log; only user ID should be written.

The processor can be activated by adding it to a custom module's services. Example here:
https://github.com/department-of-veterans-affairs/va.gov-cms/blob/main/docroot/modules/custom/va_gov_backend/va_gov_backend.services.yml#L47

Steps for Implementation

Acceptance Criteria

  • UID is add to the log messages.
@gracekretschmer-metrostar

Pull into sprint 20.

@edmund-dunn
Copy link
Contributor

edmund-dunn commented Sep 26, 2024

Image
This is what shows up for the drupal logs being passed to Datadog, note that it is only the uid NOT the username. This was taken from the logs from before we removed the default current_user processor.

The update is a copy/paste of the default processor and replacing the username part with the uid where it is being made available even though only the uid appears to be passed currently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CMS Team CMS Product team that manages both editor exp and devops
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants