From 80b9dab3b66a3f6b312ffb40bf3cc592763e5bbf Mon Sep 17 00:00:00 2001 From: ekristov Date: Mon, 14 Aug 2023 14:14:35 +0200 Subject: [PATCH] RHDEVDOCS-5369: Pipelines as Code, Logging Configuration --- ...configuring-pipelines-as-code-logging.adoc | 151 ++++++++++++++++++ pac/pac-command-reference.adoc | 4 +- 2 files changed, 154 insertions(+), 1 deletion(-) create mode 100644 modules/op-configuring-pipelines-as-code-logging.adoc diff --git a/modules/op-configuring-pipelines-as-code-logging.adoc b/modules/op-configuring-pipelines-as-code-logging.adoc new file mode 100644 index 000000000000..e1456d0de27e --- /dev/null +++ b/modules/op-configuring-pipelines-as-code-logging.adoc @@ -0,0 +1,151 @@ +// This module is included in the following assembly: +// +// * pac/pac-command-reference.adoc + +:_content-type: PROCEDURE +[id="configuring-pipelines-as-code-logging_{context}"] += Configuring {pac} logging + +You can configure {pac} logging by editing the `pac-config-logging` config map in the `TektonConfig` custom resource (CR). + +.Prerequisites + +* You have {pac} 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.dev` custom resource definition (CRD) and click *TektonConfig* to view the CRD *Details* page. + +. Click the *Instances* tab. + +. Click the *config* instance to view the `TektonConfig` CR details. + +. Click the *YAML* tab. + +. Edit the `loglevel.` fields under the `.options.configMaps.pac-config-logging.data` parameter based on your requirements. ++ +.Example `TektonConfig` CR with the {pac} log level fields set to `warn` +[source,yaml] +---- +apiVersion: operator.tekton.dev/v1alpha1 +kind: TektonConfig +metadata: + name: config +spec: + platforms: + openshift: + pipelinesAsCode: + options: + configMaps: + pac-config-logging: + data: + loglevel.pac-watcher: warn <1> + loglevel.pipelines-as-code-webhook: warn <2> + loglevel.pipelinesascode: warn <3> + 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": "" + } + } +---- +<1> The log level for the `pipelines-as-code-watcher` component. +<2> The log level for the `pipelines-as-code-webhook` component. +<3> The log level for the `pipelines-as-code-controller` component. + +. Optional: Create a custom logging config map for the {pac} components by changing the `.env.value` for each component under the `.options.deployments` field. The example below shows the configuration with the custom config map called `custom-pac-config-logging`. ++ +.Example `TektonConfig` CR with the {pac} custom logging config map +[source,yaml] +---- +apiVersion: 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 +---- diff --git a/pac/pac-command-reference.adoc b/pac/pac-command-reference.adoc index e8007cc76637..b78a8556a1bb 100644 --- a/pac/pac-command-reference.adoc +++ b/pac/pac-command-reference.adoc @@ -7,10 +7,12 @@ include::_attributes/common-attributes.adoc[] toc::[] [role="_abstract"] -You can use the `tkn pac` CLI tool to control {pac}. You can also use the `oc` command to view {pac} logs. +You can use the `tkn pac` CLI tool to control {pac}. You can also configure {pac} logging with the `TektonConfig` custom resource and use the `oc` command to view {pac} logs. include::modules/op-pipelines-as-code-command-reference.adoc[leveloffset=+1] +include::modules/op-configuring-pipelines-as-code-logging.adoc[leveloffset=+1] + include::modules/op-splitting-pipelines-as-code-logs-by-namespace.adoc[leveloffset=+1]