amosshi opened a new issue, #3435: URL: https://github.com/apache/logging-log4j2/issues/3435
**Warning!** It is highly recommended to discuss feature requests in [the mailing lists](https://logging.apache.org/log4j/2.x/support.html) first. ### Background When a log string contains `key=value` format, in modern log search tool, like [Splunk](https://www.splunk.com/) or [ELK](https://www.elastic.co/): - The `key` will become a searchable field - The `value` become the value of the corresponding key, and we can do visualization easily ### The Problem The current output for the [MdcPatternConverter](https://github.com/apache/logging-log4j2/blob/2.24.x/log4j-core/src/main/java/org/apache/logging/log4j/core/pattern/MdcPatternConverter.java) is `in a similar format to the java.util.Hashtable.toString()`, like `{key1=value1, key2=value2, key3=value3}` If we have the config bellow: - `%notEmpty{ %MDC}` > <Pattern>log4j2 timestamp=%date{ISO8601} log.level=%level{length=5} log.logger=%logger %notEmpty{ %MDC} %highlight{%message%notEmpty{ throwableMessage="%throwable{short.message}"}}%n</Pattern> The MDC part sample output will look like > > {TID=8C6976E5B54104, company=TEST-COMPANY-1, companyName=Test Company One, hashUserId=8C6976E5B, ipAddress=127.0.0.1, sessionId=45F0AB50, request=11} > Where - `{` and `}` are not useful for the log search tools (Splunk, ELK, or other tools) - `,` are in fact not needed ### The Feature Request We need an option, named like `mdcflatformat=true`, to indicate [MdcPatternConverter](https://github.com/apache/logging-log4j2/blob/2.24.x/log4j-core/src/main/java/org/apache/logging/log4j/core/pattern/MdcPatternConverter.java) will generate a flat format of: - `key1=value1 key2=value2 key3=value3` And, then the value contains a `space` (` `) , the value will be double quoted: - `key1=value1 key2=value2 key3=value3 key4="value 4"` We will config as - `%notEmpty{ %MDC}{mdcflatformat}` - Where `mdcflatformat` is the new flag we introduced The sample output above will become > > TID=8C6976E5B54104 company=TEST-COMPANY-1 companyName="Test Company One" hashUserId=8C6976E5B ipAddress=127.0.0.1 sessionId=45F0AB50 request=11 > ### Benefits - The format will be more log search tool friendly - The log generated will be smaller, because we removed the characters of `{`, `,` and `}` - Small is important, because in a big system, say we have 1 billion transactions per week, every less character in log will save cost ### Action Items When the community accept this feature request, we can provide PR and test case. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org