[ 
https://issues.apache.org/jira/browse/ZOOKEEPER-4757?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17774394#comment-17774394
 ] 

Jan Høydahl commented on ZOOKEEPER-4757:
----------------------------------------

Hi, thanks for the feedback. Yes, my motivation is to cater for the 
cloud-native use case. You are correct that it is possible to build your own 
Docker image which downloads additional JAR files from the web, places then im 
the correct lib folder in the docker image, overlays a different logback config 
file and then push that docker image to hub and use it in place of the default 
one.

Another option is to add those custom libs to an init container image and copy 
them into the default zk container during startup, or mount them in somehow.

None of these are simple or practical ways to simply enable JSON logging. It 
adds additional custom deploy infrastructure.

Given the fact that this seems to be a more and more common request, and the 
small footprint of the fix I feel we can help downstream cloud-native users by 
shipping an example.

Please see PR #2077 for a less intrusive implementation proposal where we only 
add the dependency jar and an example appender, no new env vars or code changes.

> Support JSON format logging
> ---------------------------
>
>                 Key: ZOOKEEPER-4757
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-4757
>             Project: ZooKeeper
>          Issue Type: Improvement
>            Reporter: Jan Høydahl
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 2.5h
>  Remaining Estimate: 0h
>
> More and more enterprise users request structured JSON format logging for 
> their applications. This removes the need for configuring custom log line 
> parsers for every application when collecting logs centrally.
> Zookeeper has flexible logging through Slf4j and Logback, for which there are 
> several ways to achieve JSON logging. But for end users (such as helm chart 
> user) it is very difficult to achieve. It should ideally be as simple as a 
> configuration option.
> OpenTelemetry is a CNCF project that has become the defacto standard for 
> metrics and traces collection. They also cover logging, and they recently 
> [standardized on ECS JSON 
> format|https://opentelemetry.io/blog/2023/ecs-otel-semconv-convergence/] as 
> their log schema for OTEL-logging. Although there are other JSON formats in 
> use, a pragmatic option for zookeeper is to only support ECS.
> Proposed way to enable JSON logging:
> {code:java}
> export ZOO_LOG_FORMAT=json
> bin/zkServer.sh start-foreground{code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to