For the complete documentation index, see llms.txt. This page is also available as Markdown.

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.

You can configure Kubernetes and Docker delegates in various ways. Below is an example Kubernetes delegate configuration.

Let's look at an example Kubernetes delegate configuration.

To create a custom custom delegate log, do the following:

  1. Create a ConfigMap containing your custom logback.xml file.

    # 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.xml
  2. Update your delegate.yaml file 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.xml
  3. Update your delegate.yaml file with your new JAVA_OPTS value.

         - 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.

The following configurations were added by Harness to the default Logback XML.

  • io.harness.logging.ExpiringDuplicateMessageFilter

  • io.harness.logging.remote.RemoteStackdriverLogAppender

Last updated

Was this helpful?