7.2. Configuring Pipelines as Code logging
You can configure Pipelines as Code logging by editing the pac-config-logging config map in the TektonConfig custom resource (CR).
Prerequisites
- You have Pipelines as Code installed on your cluster.
Procedure
-
In the Administrator perspective of the web console, go to Administration
CustomResourceDefinitions. -
Use the Search by name field to search for the
tektonconfigs.operator.tekton.devcustom resource definition (CRD) and click TektonConfig to view the CRD Details page. - Click the Instances tab.
-
Click the config instance to view the
TektonConfigCR details. - Click the YAML tab.
Edit the
loglevel.fields under the.options.configMaps.pac-config-logging.dataparameter based on your requirements.Example
TektonConfigCR with the Pipelines as Code log level fields set towarnapiVersion: operator.tekton.dev/v1alpha1 kind: TektonConfig metadata: name: config spec: platforms: openshift: pipelinesAsCode: options: configMaps: pac-config-logging: data: loglevel.pac-watcher: warn1 loglevel.pipelines-as-code-webhook: warn2 loglevel.pipelinesascode: warn3 zap-logger-config: | { "level": "info", "development": false, "sampling": { "initial": 100, "thereafter": 100 }, "outputPaths": ["stdout"], "errorOutputPaths": ["stderr"], "encoding": "json", "encoderConfig": { "timeKey": "ts", "levelKey": "level", "nameKey": "logger", "callerKey": "caller", "messageKey": "msg", "stacktraceKey": "stacktrace", "lineEnding": "", "levelEncoder": "", "timeEncoder": "iso8601", "durationEncoder": "", "callerEncoder": "" } }Optional: Create a custom logging config map for the Pipelines as Code components by changing the
.env.valuefor each component under the.options.deploymentsfield. The example below shows the configuration with the custom config map calledcustom-pac-config-logging.Example
TektonConfigCR with the Pipelines as Code custom logging config mapapiVersion: operator.tekton.dev/v1alpha1 kind: TektonConfig metadata: name: config spec: platforms: openshift: pipelinesAsCode: enable: true options: configMaps: custom-pac-config-logging: data: loglevel.pac-watcher: warn loglevel.pipelines-as-code-webhook: warn loglevel.pipelinesascode: warn zap-logger-config: | { "level": "info", "development": false, "sampling": { "initial": 100, "thereafter": 100 }, "outputPaths": ["stdout"], "errorOutputPaths": ["stderr"], "encoding": "json", "encoderConfig": { "timeKey": "ts", "levelKey": "level", "nameKey": "logger", "callerKey": "caller", "messageKey": "msg", "stacktraceKey": "stacktrace", "lineEnding": "", "levelEncoder": "", "timeEncoder": "iso8601", "durationEncoder": "", "callerEncoder": "" } } deployments: pipelines-as-code-controller: spec: template: spec: containers: - name: pac-controller env: - name: CONFIG_LOGGING_NAME value: custom-pac-config-logging pipelines-as-code-watcher: spec: template: spec: containers: - name: pac-watcher env: - name: CONFIG_LOGGING_NAME value: custom-pac-config-logging pipelines-as-code-webhook: spec: template: spec: containers: - name: pac-webhook env: - name: CONFIG_LOGGING_NAME value: custom-pac-config-logging