How to modify Ververica Platform's logging configuration

Question

How can I modify the logging configuration of the Ververica Platform pods (not the Flink jobs running on it)?

Answer

Note: This applies to Ververica Platform 2.0 or later

1) Create a custom Logback configuration file logback-spring.xml, like this:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <appender name="Console"
        class="ch.qos.logback.core.ConsoleAppender">
        <layout class="ch.qos.logback.classic.PatternLayout">
            <Pattern>
              %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
            </Pattern>
        </layout>
    </appender>

    <!-- LOG everything at INFO level -->
    <root level="info">
        <appender-ref ref="Console" />
    </root>
</configuration>

2) Create a ConfigMap in your platform's namespace from this file:

kubectl create configmap logback-spring \
    --from-file=logback-spring.xml \
    -n <YOUR_VVP_NAMESPACE>

3) Add the following to the root level of your values.yaml:

vvp:
 ...Ververica Platform configuration...
volumes:
  - name: "logback-spring"
    configMap:
      name: "logback-spring"
volumeMounts:
  - name: "logback-spring"
    mountPath: "/vvp/app/logback-spring.xml"
    subPath: "logback-spring.xml"

4) Update Ververica Platform's configuration:

helm upgrade --install <YOUR_VVP_RELEASE_NAME> ververica-platform \
    --repo https://charts.ververica.com \
    --namespace <YOUR_VVP_NAMESPACE> \
    --version <YOUR_VVP_VERSION> \
    --values values.yaml

5) If you want to update the template later, simply recreate the ConfigMap and restart the pods:

kubectl delete configmap logback-spring
kubectl create configmap logback-spring --from-file=logback-spring.xml -n <YOUR_VVP_NAMESPACE>
kubectl delete pods -l app=vvp-ververica-platform -n <YOUR_VVP_NAMESPACE>