3장. Cluster logging


3.1. Configuring log settings for Serving and Eventing

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

The following loglevel values are supported:

Expand
표 3.1. Supported log levels
Log levelDescription

debug

Fine-grained debugging

info

Normal logging

warn

Unexpected but non-critical errors

error

Critical errors; unexpected during normal operation

dpanic

In debug mode, trigger a panic (crash)

주의

Using the debug level for production might negatively affect performance.

3.1.2. Configuring log settings

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 loglevel value in the KnativeServing and KnativeEventing CR respectively. Here are two example configurations with all possible logging options set to level info:

    KnativeServing CR

    apiVersion: operator.knative.dev/v1beta1
    kind: KnativeServing
    metadata:
      name: knative-serving
      namespace: knative-serving
    spec:
      config:
        logging:
          loglevel.controller: "info"
          loglevel.autoscaler: "info"
          loglevel.queueproxy: "info"
          loglevel.webhook: "info"
          loglevel.activator: "info"
          loglevel.hpaautoscaler: "info"
          loglevel.net-certmanager-controller: "info"
          loglevel.net-istio-controller: "info"
          loglevel.net-kourier-controller: "info"

    KnativeEventing CR

    apiVersion: operator.knative.dev/v1beta1
    kind: KnativeEventing
    metadata:
      name: knative-eventing
      namespace: knative-eventing
    spec:
      config:
        logging:
          loglevel.controller: "info"
          loglevel.eventing-webhook: "info"
          loglevel.inmemorychannel-dispatcher: "info"
          loglevel.inmemorychannel-webhook: "info"
          loglevel.mt-broker-controller: "info"
          loglevel.mt_broker_filter: "info"
          loglevel.mt_broker_ingress: "info"
          loglevel.pingsource-mt-adapter: "info"

3.1.3. Configuring request log settings

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 observability field in your KnativeServing CR:

    Example KnativeServing CR

    apiVersion: operator.knative.dev/v1beta1
    kind: KnativeServing
    metadata:
      name: knative-serving
      namespace: knative-serving
    # ...
    spec:
      config:
        observability:
            logging.enable-request-log: true
            logging.enable-probe-request-log: true
            logging.request-log-template: '{"httpRequest": {"requestMethod": "{{.Request.Method}}", "requestUrl": "{{js .Request.RequestURI}}", "requestSize": "{{.Request.ContentLength}}", "status": {{.Response.Code}}, "responseSize": "{{.Response.Size}}", "userAgent": "{{js .Request.UserAgent}}", "remoteIp": "{{js .Request.RemoteAddr}}", "serverIp": "{{.Revision.PodIP}}", "referer": "{{js .Request.Referer}}", "latency": "{{.Response.Latency}}s", "protocol": "{{.Request.Proto}}"}, "traceId": "{{index .Request.Header "X-B3-Traceid"}}"}'
    # ...

3.1.4. Parameters of request logging

The following table describes parameters used to configure request logging.

Expand
표 3.2. Request logging configuration parameters
ParameterTypeDescription

logging.enable-request-log

Boolean (true or false)

Set to true to enable request logging.

logging.enable-probe-request-log

Boolean (true or false)

Set to true to enable the queue proxy to log probe requests to stdout. It uses the template specified in logging.request-log-template.

logging.request-log-template

Go text/template string

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:

  • Request is an http.Request representing an HTTP request received by the server.
  • Response represents the HTTP response and includes the following fields:

    • Code is the HTTP status code.
    • Size is the response size in bytes.
    • Latency is the response latency in seconds.
  • Revision contains revision details and includes the following fields:

    • Name is the name of the revision.
    • Namespace is the namespace of the revision.
    • Service is the name of the service.
    • Configuration is the name of the configuration.
    • PodName is the name of the pod hosting the revision.
    • PodIP is the IP address of the hosting pod.
Red Hat logoGithubredditYoutubeTwitter

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 소개

Red Hat은 기업이 핵심 데이터 센터에서 네트워크 에지에 이르기까지 플랫폼과 환경 전반에서 더 쉽게 작업할 수 있도록 강화된 솔루션을 제공합니다.

보다 포괄적 수용을 위한 오픈 소스 용어 교체

Red Hat은 코드, 문서, 웹 속성에서 문제가 있는 언어를 교체하기 위해 최선을 다하고 있습니다. 자세한 내용은 다음을 참조하세요.Red Hat 블로그.

Red Hat 문서 정보

Legal Notice

Theme

© 2026 Red Hat
맨 위로 이동