Skip to content

Adding Layout to logback-ecs-encoder #144

@dgempiuc

Description

@dgempiuc

If there is an error in incoming requests, I am logging this request and some requests may contain sensitive information, such as password.

There is LayoutWrappingEncoder encoder on logback and I am able to add Layout that.

        <encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
            <layout class="org.custom.ecs.layout.MaskingPatternLayout">
                <maskPattern>\"oldPassword\"\s*:\s*\"(.*?)\"</maskPattern> <!-- password pattern -->
                <maskPattern>\"newPassword\"\s*:\s*\"(.*?)\"</maskPattern> <!-- password pattern -->
                <pattern>${CONSOLE_LOG_PATTERN}</pattern>
            </layout>
        </encoder>

payload={
"newPassword": "********",
"oldPassword": "********",
"smsCode": "123456"
}

But, I am using EcsEncoder in production environment, but there is no option to add Layout in this encoder. So, I can't mask fields. Is there anyway to do that or is there any plan to add this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-javacommunityIssues and PRs created by the community

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions