Skip to content

Commit 6502ebf

Browse files
committed
[SRVCOM-2510] Configuring request log settings
Add for Serving to module title QE review feedback for SRVCOM-2510 PR feedback for SRVCOM-2510 MR feedback no1 for SRVCOM-2510 MR feedback: parameters in a REF module Improve add resource in procedure MR: Add intro sentence and table title
1 parent 4d4b63a commit 6502ebf

File tree

3 files changed

+81
-0
lines changed

3 files changed

+81
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * serverless/observability/serverless-config-log-settings.adoc
4+
5+
:_mod-docs-content-type: PROCEDURE
6+
[id="serverless-config-request-log_{context}"]
7+
= Configuring request log settings
8+
9+
You can configure request logging for your service in the `observability` field of your `KnativeServing` custom resource (CR).
10+
11+
For information about the available parameters for configuring request logging, see "Parameters of request logging".
12+
13+
.Procedure
14+
15+
* Configure request logging for your service by modifying the `observability` field in your `KnativeServing` CR:
16+
+
17+
.Example `KnativeServing` CR
18+
[source,yaml]
19+
----
20+
apiVersion: operator.knative.dev/v1beta1
21+
kind: KnativeServing
22+
metadata:
23+
name: knative-serving
24+
namespace: knative-serving
25+
# ...
26+
spec:
27+
config:
28+
observability:
29+
logging.enable-request-log: true
30+
logging.enable-probe-request-log: true
31+
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"}}"}'
32+
# ...
33+
----
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+
// * serverless/observability/serverless-config-log-settings.adoc
4+
5+
:_mod-docs-content-type: REFERENCE
6+
[id="serverless-request-log-parameters_{context}"]
7+
= Parameters of request logging
8+
9+
The following table describes parameters used to configure request logging.
10+
11+
.Request logging configuration parameters
12+
[cols=3*,options="header"]
13+
|===
14+
|Parameter
15+
|Type
16+
|Description
17+
18+
|`logging.enable-request-log`
19+
|Boolean (`true` or `false`)
20+
|Set to `true` to enable request logging.
21+
22+
|`logging.enable-probe-request-log`
23+
|Boolean (`true` or `false`)
24+
|Set to `true` to enable the queue proxy to log probe requests to stdout. It uses the template specified in `logging.request-log-template`.
25+
26+
|`logging.request-log-template`
27+
|Go `text/template` string
28+
|Determine the shape of the request logs. Use a single line to prevent logs from being split into multiple records.
29+
|===
30+
31+
The `logging.request-log-template` parameter includes the following functions:
32+
33+
* `Request` is an `http.Request` representing an HTTP request received by the server.
34+
* `Response` represents the HTTP response and includes the following fields:
35+
** `Code` is the HTTP status code.
36+
** `Size` is the response size in bytes.
37+
** `Latency` is the response latency in seconds.
38+
* `Revision` contains revision details and includes the following fields:
39+
** `Name` is the name of the revision.
40+
** `Namespace` is the namespace of the revision.
41+
** `Service` is the name of the service.
42+
** `Configuration` is the name of the configuration.
43+
** `PodName` is the name of the pod hosting the revision.
44+
** `PodIP` is the IP address of the hosting pod.

observability/cluster-logging/serverless-config-log-settings.adoc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,7 @@ You can configure logging for OpenShift Serverless Serving and OpenShift Serverl
1111
include::modules/serverless-config-log-supported-log-levels.adoc[leveloffset=+1]
1212

1313
include::modules/serverless-config-log-settings-serving-eventing.adoc[leveloffset=+1]
14+
15+
include::modules/serverless-config-request-log.adoc[leveloffset=+1]
16+
17+
include::modules/serverless-request-log-parameters.adoc[leveloffset=+1]

0 commit comments

Comments
 (0)