You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "Volkan Yazici (Jira)" <ji...@apache.org> on 2020/11/13 15:41:00 UTC

[jira] [Created] (LOG4J2-2962) Make "key" optional and add "flatten" to JsonTemplateLayout "map" resolver

Volkan Yazici created LOG4J2-2962:
-------------------------------------

             Summary: Make "key" optional and add "flatten" to JsonTemplateLayout "map" resolver
                 Key: LOG4J2-2962
                 URL: https://issues.apache.org/jira/browse/LOG4J2-2962
             Project: Log4j 2
          Issue Type: Improvement
          Components: Layouts
    Affects Versions: 2.14.0
            Reporter: Volkan Yazici


As [reported by Magnus Kvalheim in a log4j2-logstash-layout issue|https://github.com/vy/log4j2-logstash-layout/issues/68#issuecomment-726357901], there is a request as follows:

bq. With the message resolver it's possible to set the {{fallbackKey}} - an item to wishlist would be to be able to do the opposite. That is option to disregard {{SimpleMessage}} (as it's already printed in the {{message}} field.) Another option could be to use the mapresolver without specifying key?

If I understand the request right, making {{key}} directive optional (hence, one would be able to resolve the entire {{MapMessage}}) and adding a {{flatten}} directive (similar to the one in MDC resolver) can address this wish. That is,

{code}
config        = [ key ] , [ stringified ] , [ flatten ]
key           = "key" -> string
stringified   = "stringified" -> boolean
flatten       = "flatten" -> ( boolean | flattenConfig )
flattenConfig = [ flattenPrefix ]
flattenPrefix = "prefix" -> string
{code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)