Customize delegate logging
This topic describes how to customize delegate logging.
The delegate automatically creates a new log daily, named delegate.log. You can customize delegate logging if the default setup doesn't fit your needs. For example, you can customize the layout, verbosity, and destination of the messages.
To create customized delegate logging for Kubernetes and Docker delegates, you can provide a custom logback.xml file to the delegate. You can accomplish this by mounting the file inside the delegate container or building it in your custom container. Then, update the delegate JAVA_OPTS with the logback option for the custom path to the configuration. This will enable you to customize the logging behavior of the delegate according to your specific needs.
For more information on default delegate logs, go to Delegate logs.
Let's look at an example Kubernetes delegate configuration.
To create a custom custom delegate log, do the following:
Create a ConfigMap containing your custom
logback.xmlfile.# This creates a new ConfigMap named custom-logback in a harness-delegate-ng namespace kubectl create configmap custom-logback -n harness-delegate-ng --from-file=custom-logback.xmlUpdate your
delegate.yamlfile to mount the new ConfigMap.volumeMounts: - name: config-volume mountPath: /opt/harness-delegate/logback/ volumes: - name: config-volume configMap: name: custom-logback items: - key: custom-logback.xml path: custom-logback.xmlUpdate your
delegate.yamlfile with your newJAVA_OPTSvalue.- name: JAVA_OPTS value: "-Dlogback.configurationFile=/opt/harness-delegate/logback/custom-logback.xml"
Default logging configuration
Here is the default logging configuration for the Harness Delegate.
Last updated
Was this helpful?