Skip to content

Commit

Permalink
Make custom logging configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
alisihab authored Aug 1, 2024
1 parent 18c7adb commit c03bea5
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 14 deletions.
2 changes: 1 addition & 1 deletion charts/drill/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v2
name: drill
version: 1.3.2
version: 1.3.3
appVersion: 1.21.1
description: Helm Charts for deploying Apache Drill Clusters on Kubernetes
icon: https://raw.githubusercontent.com/wearefrank/charts/master/charts/drill/icon.svg
Expand Down
28 changes: 15 additions & 13 deletions charts/drill/templates/configmap.override.yaml
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
{{/*
ConfigMap for generating override.conf files
ConfigMap for generating drill-override.conf and logback.xml files
*/}}
{{- if (not .Values.drill.overrideConfiguration.existingConfigMap) -}}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "drill.fullname" . }}-override
labels:
{{- include "drill.labels" . | nindent 4 }}
data:
{{- if (not .Values.drill.overrideConfiguration.existingConfigMap) -}}
drill-override.conf: |-
drill.exec: {
cluster-id: "{{ include "drill.fullname" . }}",
zk.connect: "{{ include "zookeeper.fullname" . }}:2181",
http.port: 8047
}
{{- toString .Values.drill.overrideConfiguration.drill | nindent 4 }}
{{- end -}}
{{- with .Values.drill.overrideConfiguration.drillMetastore }}
drill-metastore-override.conf: |-
{{- toString . | nindent 4 }}
Expand All @@ -32,31 +33,32 @@ data:
storage-plugins-override.conf: |-
{{- toString . | nindent 4 }}
{{- end }}
{{- if .Values.drill.overrideLogging.enabled -}}
logback.xml: |-
<configuration>
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>/var/lib/drill/log/drill.log</file>
<file>{{ .Values.drill.overrideLogging.filePath | default "/var/lib/drill/log/drill.log" }}</file>
<rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
<fileNamePattern>/var/lib/drill/log/drill.%i.log</fileNamePattern>
<minIndex>1</minIndex>
<maxIndex>9</maxIndex>
<fileNamePattern>{{ .Values.drill.overrideLogging.fileNamePattern | default "/var/lib/drill/log/drill.%i.log" }}</fileNamePattern>
<minIndex>{{ .Values.drill.overrideLogging.minIndex | default 1 }}</minIndex>
<maxIndex>{{ .Values.drill.overrideLogging.maxIndex | default 9 }}</maxIndex>
</rollingPolicy>
<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
<maxFileSize>5MB</maxFileSize>
<maxFileSize>{{ .Values.drill.overrideLogging.maxFileSize | default "10MB" }}</maxFileSize>
</triggeringPolicy>
<encoder>
<pattern>%date [%thread] %-5level %logger{35} - %msg%n</pattern>
<pattern>{{ .Values.drill.overrideLogging.pattern | default "%date [%thread] %-5level %logger{35} - %msg%n" }}</pattern>
</encoder>
</appender>
<root level="debug">
<root level="{{ .Values.drill.overrideLogging.rootLevel | default "debug" }}">
<appender-ref ref="FILE"/>
</root>
<logger name="org.apache.drill" level="trace"/>
<logger name="org.apache.calcite" level="trace"/>
<logger name="org.apache.zookeeper" level="trace"/>
{{- range .Values.drill.overrideLogging.loggers }}
<logger name="{{ .name }}" level="{{ .level | default "trace" }}"/>
{{- end }}
</configuration>
{{- end -}}
{{- end -}}
57 changes: 57 additions & 0 deletions charts/drill/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,11 @@ securityContext: { }
## ```
##
## For more options refer to the [Apache Drill documentation](https://drill.apache.org/docs/configuration-options-introduction/).
##
## Additionally, this section allows you to override the default logging configuration for Apache Drill.
## By default, Apache Drill uses a built-in logging configuration, but you can customize it by enabling drill.overrideLogging.
## You can specify custom logging settings such as file paths, log rotation policies, logging levels, and more.
##
## @descriptionEnd
##
drill:
Expand Down Expand Up @@ -325,6 +330,58 @@ drill:
## password: changeit
##
users: [ ]
overrideLogging:
## @param drill.overrideLogging.enabled [boolean] Set to true to override the default logging configuration
## This will create a custom logback.xml file for Drill.
##
enabled: false

## @param drill.overrideLogging.filePath [string] The file path where logs will be written.
## Default is `/var/lib/drill/log/drill.log`.
##
filePath: "/var/lib/drill/log/drill.log"

## @param drill.overrideLogging.fileNamePattern [string] The pattern for log file rotation.
## Default is `/var/lib/drill/log/drill.%i.log`.
##
fileNamePattern: "/var/lib/drill/log/drill.%i.log"

## @param drill.overrideLogging.minIndex [integer] The minimum index for log file rotation.
## Default is `1`.
##
minIndex: 1

## @param drill.overrideLogging.maxIndex [integer] The maximum index for log file rotation.
## Default is `9`.
##
maxIndex: 9

## @param drill.overrideLogging.maxFileSize [string] The maximum size for each log file before rotation.
## Default is `10MB`.
##
maxFileSize: "10MB"

## @param drill.overrideLogging.pattern [string] The logging pattern used in log messages.
## Default is `%date [%thread] %-5level %logger{35} - %msg%n`.
##
pattern: "%date [%thread] %-5level %logger{35} - %msg%n"

## @param drill.overrideLogging.rootLevel [string] The logging level for the root logger.
## Default is `debug`.
##
rootLevel: "debug"

## @param drill.overrideLogging.loggers [array] Additional loggers to configure with specific levels.
## Each logger should have a `name` and `level`.
## e.g.
## loggers:
## - name: org.apache.drill
## level: trace
## - name: org.apache.calcite
## level: trace
##
loggers: []


## @param extraVolumes Optionally specify extra list of additional volumes for Drill pods
##
Expand Down

0 comments on commit c03bea5

Please sign in to comment.