You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "Mikael Ståldal (JIRA)" <ji...@apache.org> on 2017/12/04 21:10:00 UTC
[jira] [Comment Edited] (LOG4J2-2139) JSONLayout ability to rename
keys in log output - particularly locationInfo "source"
[ https://issues.apache.org/jira/browse/LOG4J2-2139?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16277493#comment-16277493 ]
Mikael Ståldal edited comment on LOG4J2-2139 at 12/4/17 9:09 PM:
-----------------------------------------------------------------
You find the reference here: http://logging.apache.org/log4j/2.x/manual/layouts.html#PatternLayout
You can do something like this:
{code:xml}
<PatternLayout pattern='{"timeMillis":%d{UNIX_MILLIS},"thread":"%enc{%thread}{JSON}","level":"%enc{%level}{JSON}","loggerName":"%enc{%logger}{JSON}","message":"%enc{%m}{JSON}","thrown":"%enc{%ex}{JSON}"}'
alwaysWriteExceptions="false"/>
{code}
was (Author: mikaelstaldal):
You find the reference here: http://logging.apache.org/log4j/2.x/manual/layouts.html#PatternLayout
You can do something like this:
{code:xml}
<PatternLayout pattern='{"timeMillis":%d{UNIX_MILLIS},"thread":"%enc{%thread}{JSON}","level":"%enc{%level}{JSON}","loggerName":"%enc{%logger}{JSON}","message":"%enc{%m}{JSON}"}'/>
{code}
> JSONLayout ability to rename keys in log output - particularly locationInfo "source"
> ------------------------------------------------------------------------------------
>
> Key: LOG4J2-2139
> URL: https://issues.apache.org/jira/browse/LOG4J2-2139
> Project: Log4j 2
> Issue Type: Improvement
> Components: Layouts
> Reporter: Daniel Kirkdorffer
> Priority: Minor
> Labels: json
>
> We ran into a problem when setting {{locationInfo}} to {{true}} when ingesting logs into Kibana. The problem had to do with a conflict with another existing key named {{"source"}} of type String, and the fact that {{locationInfo}} produces an Object called "source".
> So it would be nice to have a way to supply a different Object name. Perhaps this could be broadened so that other key names could also be renamed?
> Maybe there is a way to do this already?
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)