[ 
https://issues.apache.org/jira/browse/LOG4J2-3343?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17477957#comment-17477957
 ] 

Ralph Goers edited comment on LOG4J2-3343 at 1/18/22, 3:07 PM:
---------------------------------------------------------------

My preference would be to not use a pattern. Primarily because a pattern to 
exclude a list of keys is way harder than a simple list. I would prefer
{code:java}
{
  '$resolver: "mdc",
  'excludes': ['token', 'internalId', 'password']
}{code}
if need be each of the items could be a pattern in which case you could have
{code:java}
{
'$resolver: "mdc",
'excludePatterns': ['token', 'internalId', 'password|pwd']
} {code}
 

While having a single pattern of 'token|internalId|password|pwd' works too it 
just gets ugly.


was (Author: [email protected]):
My preference would be to not use a pattern. Primarily because a pattern to 
exclude a list of keys is way harder than a simple list. I would prefer


{code:java}
{
  '$resolver: "mdc",
  'excludes': ['token', 'internalId', 'password']
}{code}
if need be each of the items could be a pattern in which case you could have
{code:java}
{
'$resolver: "mdc",
'excludePatterns': ['token', 'internalId', 'password|pwd']
} {code}
 

 

> Add ability to use exclusion pattern filter on Map Resolver keys
> ----------------------------------------------------------------
>
>                 Key: LOG4J2-3343
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-3343
>             Project: Log4j 2
>          Issue Type: New Feature
>          Components: JsonTemplateLayout
>            Reporter: Matt Sicker
>            Assignee: Matt Sicker
>            Priority: Major
>             Fix For: 2.17.2
>
>
> Map Resolver currently supports specifying a pattern to filter for allowed 
> keys in the map being resolved. I'd like a complementary feature to specify a 
> pattern to filter for excluded keys from the map being resolved. It may also 
> be beneficial to provide a similar option for excluded keys as full string 
> matches rather than always using a pattern.
> For an example use case, suppose I copy request HTTP header names and values 
> into the ThreadContext for every request. In Spinnaker microservices, this 
> includes custom headers like {{X-Spinnaker-Groups}} which contains a list of 
> groups the authenticated user belongs to which are filled in by the Fiat 
> microservice (used for integrating authentication and authorization with 
> various providers and providing a facade over Spring Security). If I want to 
> exclude this header from being logged, I can currently set a negative 
> lookahead pattern like {{(?i(?!x-spinnaker-groups))}} which works effectively 
> the same, but how many developers like reading regex incantations like these?



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to