[
https://issues.apache.org/jira/browse/LOG4J2-2849?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17112627#comment-17112627
]
Ralph Goers commented on LOG4J2-2849:
-------------------------------------
The event Lookup was added in 2.13.2. I would suggest you upgrade to the latest
version.
> Event Lookup Field not applying to JSON Layout additional Property
> ------------------------------------------------------------------
>
> Key: LOG4J2-2849
> URL: https://issues.apache.org/jira/browse/LOG4J2-2849
> Project: Log4j 2
> Issue Type: Question
> Components: Lookups
> Affects Versions: 2.10.0
> Reporter: Peter Podniesinski
> Priority: Minor
>
> Hi, I have a requirement where we need to change the field name of our
> LogEvent from `message` to `text`. In the past we've done this by creating a
> new custom Layout that modifies the logEvent, however I was hoping I could do
> this with JSON Layout lookups to the Event data.
> Here is a snippet of my log4j xml config. I've tried a few variations and the
> event variable is not recognized.
> {code:java}
> <RollingFile name="APPLOGFILE"
> fileName="logs/app/${hostName}/application.log"
> filePattern="logs/app/${hostName}/app-%d{MM-dd-yyyy}-%i.log.gz">
> <JsonLayout complete="false" compact="true" eventEol="true" properties="true"
> stacktraceAsString="true">
> <KeyValuePair key="timestamp" value= "$${date:yyyy-MM-dd HH:mm:ss.SSS}"/>
> <KeyValuePair key="text" value= "$${ctx:productId}"/>
> <KeyValuePair key="text2" value= "${event:Message}"/>
> <KeyValuePair key="text3" value= "$${event:Message}"/>
> </JsonLayout>
> {code}
> Context fields and date do indeed work.
>
> Please let me know if I am misusing the lookup functionality or if there is a
> bug.
> Also, if there is a better way to do this, that information would be helpful
> as well.
>
> Thanks.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)