Skip to content

How to mask sensitive values (e.g., passwords, API keys) in structured logs in Spring Boot 3.4? #46524

@mehrdadbozorgmehr

Description

@mehrdadbozorgmehr

I’m using Spring Boot 3.4 with structured logging (via JsonWriterStructuredLogFormatter), and I want to mask sensitive data such as passwords, API keys, and tokens from the message field in the logs.

What I've tried: I'm using the default structured logging setup. logstash format

I created a StructuredLoggingJsonMembersCustomizer and modified the message field by applying regex masking. but I can't change or override the content value of "message" key

Metadata

Metadata

Assignees

No one assigned

    Labels

    for: stackoverflowA question that's better suited to stackoverflow.comstatus: invalidAn issue that we don't feel is valid

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions