You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by fr...@apache.org on 2022/09/14 03:47:19 UTC

[druid] branch master updated: Provide service specific log4j overrides in containerized deployments (#13020)

This is an automated email from the ASF dual-hosted git repository.

frankchen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/druid.git


The following commit(s) were added to refs/heads/master by this push:
     new a8fd3a9077 Provide service specific log4j overrides in containerized deployments (#13020)
a8fd3a9077 is described below

commit a8fd3a90779a007676ba4cb9ca8d35633b781884
Author: Atul Mohan <at...@gmail.com>
AuthorDate: Tue Sep 13 20:47:11 2022 -0700

    Provide service specific log4j overrides in containerized deployments (#13020)
    
    * Provide service specific log4j overrides
    
    * Clarify comments
    
    * Add docs
---
 distribution/docker/druid.sh | 16 +++++++++++++++-
 docs/tutorials/docker.md     |  2 ++
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/distribution/docker/druid.sh b/distribution/docker/druid.sh
index 82e7c8a001..f3b506d64c 100755
--- a/distribution/docker/druid.sh
+++ b/distribution/docker/druid.sh
@@ -28,7 +28,9 @@
 #
 # Additional env vars:
 # - DRUID_LOG4J -- set the entire log4j.xml verbatim
-# - DRUID_LOG_LEVEL -- override the default log level in default log4j
+# - DRUID_LOG_LEVEL -- override the default log level in default log4j. This presently works only if the existing log level is INFO
+# - DRUID_SERVICE_LOG4J -- set the entire service specific log4j.xml verbatim
+# - DRUID_SERVICE_LOG_LEVEL -- override the default log level in the service specific log4j. This presently works only if the existing log level is INFO
 # - DRUID_XMX -- set Java Xmx
 # - DRUID_XMS -- set Java Xms
 # - DRUID_MAXNEWSIZE -- set Java max new size
@@ -176,6 +178,18 @@ then
     echo "$DRUID_LOG4J" >$COMMON_CONF_DIR/log4j2.xml
 fi
 
+# Service level log options can be used when the log4j2.xml file is setup in the service config directory
+# instead of the common config directory
+if [ -n "$DRUID_SERVICE_LOG_LEVEL" ]
+then
+    sed -ri 's/"info"/"'$DRUID_SERVICE_LOG_LEVEL'"/g' $SERVICE_CONF_DIR/log4j2.xml
+fi
+
+if [ -n "$DRUID_SERVICE_LOG4J" ]
+then
+    echo "$DRUID_SERVICE_LOG4J" >$SERVICE_CONF_DIR/log4j2.xml
+fi
+
 DRUID_DIRS_TO_CREATE=${DRUID_DIRS_TO_CREATE-'var/tmp var/druid/segments var/druid/indexing-logs var/druid/task var/druid/hadoop-tmp var/druid/segment-cache'}
 if [ -n "${DRUID_DIRS_TO_CREATE}" ]
 then
diff --git a/docs/tutorials/docker.md b/docs/tutorials/docker.md
index 2491c34798..42db911378 100644
--- a/docs/tutorials/docker.md
+++ b/docs/tutorials/docker.md
@@ -78,6 +78,8 @@ Logging configuration:
 
 * `DRUID_LOG4J` -- set the entire [`log4j.xml` configuration file](https://logging.apache.org/log4j/2.x/manual/configuration.html#XML)  verbatim. ([Example](https://github.com/apache/druid/blob/{{DRUIDVERSION}}/distribution/docker/environment#L52))
 * `DRUID_LOG_LEVEL` -- override the default [Log4j log level](https://en.wikipedia.org/wiki/Log4j#Log4j_log_levels)
+* `DRUID_SERVICE_LOG4J` -- set the entire [`log4j.xml` configuration file](https://logging.apache.org/log4j/2.x/manual/configuration.html#XML)  verbatim specific to a service.
+* `DRUID_SERVICE_LOG_LEVEL` -- override the default [Log4j log level](https://en.wikipedia.org/wiki/Log4j#Log4j_log_levels) in the service specific log4j.
 
 Advanced memory configuration:
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org