[
https://issues.apache.org/jira/browse/LOG4J2-2062?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16188669#comment-16188669
]
ASF GitHub Bot commented on LOG4J2-2062:
----------------------------------------
Github user mikaelstaldal commented on the issue:
https://github.com/apache/logging-log4j2/pull/112
@flowcont I think it would make more sense to have the value for the key as
an attribute on the Kafka appender element, and not as a nested property, since
the nested properties are passed directly to the [Kafka client
library](http://kafka.apache.org/documentation.html#producerconfigs).
So you can specify it like this:
```
<Appenders>
<Kafka name="Kafka" topic="log-test" key="myKey">
<PatternLayout pattern="%date %message"/>
<Property name="bootstrap.servers">localhost:9092</Property>
</Kafka>
</Appenders>
```
> Add possibility of sending the key of a message to Kafka using KafkaAppender
> ----------------------------------------------------------------------------
>
> Key: LOG4J2-2062
> URL: https://issues.apache.org/jira/browse/LOG4J2-2062
> Project: Log4j 2
> Issue Type: Improvement
> Components: Appenders
> Affects Versions: 2.9.0
> Reporter: Jorge Sanchez
> Priority: Minor
>
> When using the KafkaAppender the KafkaManager only sends the value of a
> message to a Kafka topic.
> It could be useful to be able to assign a value to the key of that message
> via configuration instead of having it null.
> Check
> https://github.com/apache/logging-log4j2/blob/master/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/mom/kafka/KafkaManager.java#L99
> Updated with link to the PR: https://github.com/apache/logging-log4j2/pull/112
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)