Chapter 3. Cluster logging
3.1. Configuring log settings for Serving and Eventing Copy linkLink copied to clipboard!
You can configure logging for OpenShift Serverless Serving and OpenShift Serverless Eventing using the KnativeServing and KnativeEventing custom resource (CR). The level of logging is determined by the specified loglevel value.
3.1.1. Supported log levels Copy linkLink copied to clipboard!
The following loglevel values are supported:
| Log level | Description |
|---|---|
|
| Fine-grained debugging |
|
| Normal logging |
|
| Unexpected but non-critical errors |
|
| Critical errors; unexpected during normal operation |
|
| In debug mode, trigger a panic (crash) |
Using the debug level for production might negatively affect performance.
3.1.2. Configuring log settings Copy linkLink copied to clipboard!
You can configure logging for Serving and Eventing in the KnativeServing custom resource (CR) and KnativeEventing CR.
Procedure
Configure the log settings for Serving and Eventing by setting or modifying the
loglevelvalue in theKnativeServingandKnativeEventingCR respectively. Here are two example configurations with all possible logging options set to levelinfo:KnativeServing CR
Copy to Clipboard Copied! Toggle word wrap Toggle overflow KnativeEventing CR
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
3.1.3. Configuring request log settings Copy linkLink copied to clipboard!
You can configure request logging for your service in the observability field of your KnativeServing custom resource (CR).
For information about the available parameters for configuring request logging, see "Parameters of request logging".
Procedure
Configure request logging for your service by modifying the
observabilityfield in yourKnativeServingCR:Example
KnativeServingCRCopy to Clipboard Copied! Toggle word wrap Toggle overflow
3.1.4. Parameters of request logging Copy linkLink copied to clipboard!
The following table describes parameters used to configure request logging.
| Parameter | Type | Description |
|---|---|---|
|
|
Boolean ( |
Set to |
|
|
Boolean ( |
Set to |
|
|
Go | Determine the shape of the request logs. Use a single line to prevent logs from being split into multiple records. |
The logging.request-log-template parameter includes the following functions:
-
Requestis anhttp.Requestrepresenting an HTTP request received by the server. Responserepresents the HTTP response and includes the following fields:-
Codeis the HTTP status code. -
Sizeis the response size in bytes. -
Latencyis the response latency in seconds.
-
Revisioncontains revision details and includes the following fields:-
Nameis the name of the revision. -
Namespaceis the namespace of the revision. -
Serviceis the name of the service. -
Configurationis the name of the configuration. -
PodNameis the name of the pod hosting the revision. -
PodIPis the IP address of the hosting pod.
-