Skip to content

Commit e09121d

Browse files
Merge pull request #61438 from xenolinux/set-log-levels
OSDOCS#6030: cert-manager: setting log levels
2 parents 1329344 + 67a9e21 commit e09121d

File tree

4 files changed

+119
-0
lines changed

4 files changed

+119
-0
lines changed

_topic_maps/_topic_map.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1006,6 +1006,8 @@ Topics:
10061006
File: cert-manager-customizing-api-fields
10071007
- Name: Authenticating the cert-manager Operator with AWS Security Token Service
10081008
File: cert-manager-authenticate-aws
1009+
- Name: Configuring log levels for cert-manager and the cert-manager Operator for Red Hat OpenShift
1010+
File: cert-manager-log-levels
10091011
- Name: Uninstalling the cert-manager Operator for Red Hat OpenShift
10101012
File: cert-manager-operator-uninstall
10111013
- Name: Viewing audit logs
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * security/cert_manager_operator/cert-manager-log-levels.adoc
4+
5+
:_content-type: PROCEDURE
6+
[id="cert-manager-enable-operand-log-level_{context}"]
7+
= Setting a log level for cert-manager
8+
9+
You can set a log level for cert-manager to determine the verbosity of log messages.
10+
11+
.Prerequisites
12+
13+
* You have access to the cluster with `cluster-admin` privileges.
14+
* You have installed the {cert-manager-operator} 1.11.1 or later.
15+
16+
.Procedure
17+
18+
. Edit the `CertManager` resource by running the following command:
19+
+
20+
[source,terminal]
21+
----
22+
$ oc edit certmanager.operator cluster
23+
----
24+
25+
. Set the log level value by editing the `spec.logLevel` section:
26+
+
27+
[source,yaml]
28+
----
29+
apiVersion: operator.openshift.io/v1alpha1
30+
kind: CertManager
31+
...
32+
spec:
33+
logLevel: Normal <1>
34+
----
35+
<1> The default `logLevel` is `Normal`. Replace `Normal` with the desired log level value. The valid log level values for the `CertManager` resource are `Normal`, `Debug`, `Trace`, and `TraceAll`. To audit logs and perform common operations when everything is fine, set `logLevel` to `Normal` . To troubleshoot a minor issue by viewing verbose logs, set `logLevel` to `Debug` . To troubleshoot a major issue by viewing more verbose logs, you can set `logLevel` to `Trace`. To troubleshoot serious issues, set `logLevel` to `TraceAll`.
36+
+
37+
[NOTE]
38+
====
39+
`TraceAll` generates huge amount of logs. After setting `logLevel` to `TraceAll`, you might experience performance issues.
40+
====
41+
42+
. Save your changes and quit the text editor to apply your changes.
43+
+
44+
After applying the changes, the verbosity level for the cert-manager components controller, CA injector, and webhook is updated.
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * security/cert_manager_operator/cert-manager-log-levels.adoc
4+
5+
:_content-type: PROCEDURE
6+
[id="cert-manager-enable-operator-log-level_{context}"]
7+
= Setting a log level for the {cert-manager-operator}
8+
9+
You can set a log level for the {cert-manager-operator} to determine the verbosity of the operator log messages.
10+
11+
.Prerequisites
12+
13+
* You have access to the cluster with `cluster-admin` privileges.
14+
* You have installed the {cert-manager-operator} 1.11.1 or later.
15+
16+
.Procedure
17+
18+
* Update the subscription object for {cert-manager-operator} to provide the verbosity level for the operator logs by running the following command:
19+
+
20+
[source,terminal]
21+
----
22+
$ oc -n cert-manager-operator patch subscription openshift-cert-manager-operator --type='merge' -p '{"spec":{"config":{"env":[{"name":"OPERATOR_LOG_LEVEL","value":"v"}]}}}' <1>
23+
----
24+
<1> Replace `v` with the desired log level number. The valid values for `v` can range from `1`to `10`. The default value is `2`.
25+
26+
.Verification
27+
28+
. The cert-manager Operator pod is redeployed. Verify that the log level of the {cert-manager-operator} is updated by running the following command:
29+
+
30+
[source,terminal]
31+
----
32+
$ oc set env deploy/cert-manager-operator-controller-manager -n cert-manager-operator --list | grep -e OPERATOR_LOG_LEVEL -e container
33+
----
34+
+
35+
.Example output
36+
[source,terminal]
37+
----
38+
# deployments/cert-manager-operator-controller-manager, container kube-rbac-proxy
39+
OPERATOR_LOG_LEVEL=9
40+
# deployments/cert-manager-operator-controller-manager, container cert-manager-operator
41+
OPERATOR_LOG_LEVEL=9
42+
----
43+
44+
. Verify that the log level of the {cert-manager-operator} is updated by running the `oc logs` command:
45+
+
46+
[source,terminal]
47+
----
48+
$ oc logs deploy/cert-manager-operator-controller-manager -n cert-manager-operator
49+
----
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
:_content-type: ASSEMBLY
2+
[id="cert-manager-log-levels"]
3+
= Configuring log levels for cert-manager and the {cert-manager-operator}
4+
include::_attributes/common-attributes.adoc[]
5+
:context: cert-manager-log-levels
6+
7+
toc::[]
8+
9+
To troubleshoot issues with the cert-manager components and the {cert-manager-operator}, you can configure the log level verbosity.
10+
11+
[NOTE]
12+
====
13+
To use different log levels for different cert-manager components, see _Customizing cert-manager Operator API fields_.
14+
====
15+
16+
include::modules/cert-manager-enable-operand-log-level.adoc[leveloffset=+1]
17+
18+
include::modules/cert-manager-enable-operator-log-level.adoc[leveloffset=+1]
19+
20+
[role="_additional-resources"]
21+
[id="cert-manager-log-levels_additional-resources"]
22+
== Additional resources
23+
24+
* xref:../../security/cert_manager_operator/cert-manager-customizing-api-fields.adoc#cert-manager-customizing-api-fields[Customizing cert-manager Operator API fields]

0 commit comments

Comments
 (0)