Repository navigation
Add a setting to leave request bodies out of the console and file audit logs - #1476
Merged
Merged
Conversation
…it logs Audit log lines carry the full request body, which for most requests is investigation data: observable values, context, search terms. With [system] audit_log_bodies set to false, the console and audit_logfile lines keep the user, path, method, client and status and leave the body out. The auditlog collection still records it. The default is true, which is the behaviour until now. JsonFormatter takes include_body, and the console format string comes from text_log_format(); with the default it is the same string as before. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
tomchop
approved these changes
Nov 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1474.
Audit log lines carry the full request body, which for most requests is investigation data: observable values, context, search terms. This adds
audit_log_bodiesto[system](alsoYETI_SYSTEM_AUDIT_LOG_BODIES). It defaults to true, which is today's behaviour.With it set to false, the console and
audit_logfilelines keep the time, user, path, method, client and status, and leave the body out:{"message": "Authorized request", "severity": "INFO", "timestamp": "2026-11-17T02:38:30.334243+00:00", "logger": "yeti.audit.log", "username": "probe", "path": "/api/v2/observables/", "method": "POST", "client": "127.0.0.1", "status_code": 200}The
auditlogcollection still records the body. It sits in the same database as the objects themselves, so the setting only affects the copies that leave it.How
JsonFormattertakesinclude_body.text_log_format(include_body). With the default it is the same string as before.Tests
Four in
tests/core_tests/logger.py: the JSON line and the text line, each with the body by default and without it when asked, the other fields kept.Against a running API with the setting off, 22 requests gave 22 console lines and 22 file lines with no request value in them, and the same 20
auditlogdocuments with their content as with the setting on.Checks: ruff, ty and the three test directories in a CI-equivalent environment.
🤖 Generated with Claude Code