Mask one single field and select/unselect the other fields #639
-
I was using the encoder LoggingEventCompositeJsonEncoder for selecting the fields which would be showed up in console logs: logback.xml:
output JSON:
Last days, I've been at a spike with the purpose of masking emails in these logs. After reading the Logstash Logback Encoder doc, I realized that my only choice was the encoder LogstashEncoder wrapping the decorator MaskingJsonGeneratorDecorator. The masking itself works, but some original fields was lost e new ones was added: logback.xml:
SensitiveDataMasker.java:
output JSON with mask:
After the masking, I would like to choose what fields would compose the JSON . Since the masking has a certain complexity Is my objective possible? What paths could I take? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
You can use <springProfile name="prod">
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="net.logstash.logback.encoder.LoggingEventCompositeJsonEncoder">
<providers>
<version/>
<logLevel/>
<loggerName/>
<pattern>
<pattern>
{
"timestamp": "%d{yyyy-MM-dd'T'HH:mm:ss.SSSZZ}",
"appName": "${appName}"
}
</pattern>
</pattern>
<threadName/>
<message/>
<logstashMarkers/>
<arguments/>
<stackTrace/>
</providers>
<jsonGeneratorDecorator class="net.logstash.logback.mask.MaskingJsonGeneratorDecorator">
<valueMasker class="uol.dna.profile.logging.masking.SensitiveDataMasker" />
</jsonGeneratorDecorator>
</encoder>
</appender>
</springProfile> |
Beta Was this translation helpful? Give feedback.
-
Thanks a lot, man. |
Beta Was this translation helpful? Give feedback.
You can use
MaskingJsonGeneratorDecorator
withLoggingEventCompositeJsonEncoder
...