-
Notifications
You must be signed in to change notification settings - Fork 1.9k
OSDOCS-1002 Document Ingress Access Logging #22391
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
bmcelvee
merged 1 commit into
openshift:master
from
bmcelvee:OSDOCS-1002-ingress-access-logging
Jun 25, 2020
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,124 @@ | ||
| // Module included in the following assemblies: | ||
| // | ||
| // * ingress/configure-ingress-operator.adoc | ||
|
|
||
| [id="nw-configure-ingress-access-logging_{context}"] | ||
| = Configuring Ingress access logging | ||
|
|
||
| You can configure the Ingress Controller to enable access logs. If you have clusters that do not receive much traffic, then you can log to a sidecar. If you have high traffic clusters, to avoid exceeding the capacity of the logging stack or to integrate with a logging infrastructure outside of {product-title}, you can forward logs to a custom syslog endpoint. You can also specify the format for access logs. | ||
|
|
||
| Container logging is useful to enable access logs on low-traffic clusters when there is no existing Syslog logging infrastructure, or for short-term use while diagnosing problems with the Ingress Controller. | ||
|
|
||
| Syslog is needed for high-traffic clusters where access logs could exceed the cluster logging stack's capacity, or for environments where any logging solution needs to integrate with an existing Syslog logging infrastructure. The Syslog use-cases can overlap. | ||
|
|
||
| .Prerequisites | ||
|
|
||
| * Log in as a user with `cluster-admin` privileges. | ||
|
|
||
| .Procedure | ||
|
|
||
| Configure Ingress access logging to a sidecar. | ||
|
|
||
| * To configure Ingress access logging, you must specify a destination using `spec.logging.access.destination`. To specify logging to a sidecar container, you must specify `Container` `spec.logging.access.destination.type`. The following example is an Ingress Controller definition that logs to a `Container` destination: | ||
| + | ||
| [source, yaml] | ||
| ---- | ||
| apiVersion: operator.openshift.io/v1 | ||
| kind: IngressController | ||
| metadata: | ||
| name: default | ||
| namespace: openshift-ingress-operator | ||
| spec: | ||
| replicas: 2 | ||
| endpointPublishingStrategy: | ||
| type: NodePortService <1> | ||
| logging: | ||
| access: | ||
| destination: | ||
| type: Container | ||
| ---- | ||
| <1> `NodePortService` is not required to configure Ingress access logging to a sidecar. Ingress logging is compatible with any `endpointPublishingStrategy`. | ||
| + | ||
| * When you configure the Ingress Controller to log to a sidecar, the operator creates a container named `logs` inside the Ingress Controller Pod: | ||
| + | ||
| ---- | ||
| $ oc -n openshift-ingress logs deployment.apps/router-default -c logs | ||
| ---- | ||
| + | ||
| .Sample output: | ||
| ---- | ||
| 2020-05-11T19:11:50.135710+00:00 router-default-57dfc6cd95-bpmk6 router-default-57dfc6cd95-bpmk6 haproxy[108]: 174.19.21.82:39654 [11/May/2020:19:11:50.133] public be_http:hello-openshift:hello-openshift/pod:hello-openshift:hello-openshift:10.128.2.12:8080 0/0/1/0/1 200 142 - - --NI 1/1/0/0/0 0/0 "GET / HTTP/1.1" | ||
| ---- | ||
|
|
||
| Configure Ingress access logging to a Syslog endpoint. | ||
|
|
||
| * To configure Ingress access logging, you must specify a destination using `spec.logging.access.destination`. To specify logging to a Syslog endpoint destination, you must specify `Syslog` for `spec.logging.access.destination.type`. If the destination type is `Syslog`, you must also specify a destination endpoint using `spec.logging.access.destination.syslog.endpoint` and you can specify a facility using `spec.logging.access.destination.syslog.facility`. The following example is an Ingress Controller definition that logs to a `Syslog` destination: | ||
| + | ||
| [source, yaml] | ||
| ---- | ||
| apiVersion: operator.openshift.io/v1 | ||
| kind: IngressController | ||
| metadata: | ||
| name: default | ||
| namespace: openshift-ingress-operator | ||
| spec: | ||
| replicas: 2 | ||
| endpointPublishingStrategy: | ||
| type: NodePortService | ||
| logging: | ||
| access: | ||
| destination: | ||
| type: Syslog | ||
| syslog: | ||
| address: 1.2.3.4 | ||
| port: 10514 | ||
| ---- | ||
| + | ||
| [NOTE] | ||
| ==== | ||
| The `syslog` destination port must be UDP. | ||
| ==== | ||
|
|
||
| Configure Ingress access logging with a specific log format. | ||
|
|
||
| * You can specify `spec.logging.access.httpLogFormat` to customize the log format. The following example is an Ingress Controller definition that logs to a `syslog` endpoint with IP address 1.2.3.4 and port 10514: | ||
| + | ||
| [source, yaml] | ||
| ---- | ||
| apiVersion: operator.openshift.io/v1 | ||
| kind: IngressController | ||
| metadata: | ||
| name: default | ||
| namespace: openshift-ingress-operator | ||
| spec: | ||
| replicas: 2 | ||
| endpointPublishingStrategy: | ||
| type: NodePortService | ||
| logging: | ||
| access: | ||
| destination: | ||
| type: Syslog | ||
| syslog: | ||
| address: 1.2.3.4 | ||
| port: 10514 | ||
| httpLogFormat: '%ci:%cp [%t] %ft %b/%s %B %bq %HM %HU %HV' | ||
| ---- | ||
|
|
||
| Disable Ingress access logging. | ||
|
|
||
| * To disable Ingress access logging, leave `spec.logging` or `spec.logging.access` empty: | ||
| + | ||
| [source, yaml] | ||
| ---- | ||
| apiVersion: operator.openshift.io/v1 | ||
| kind: IngressController | ||
| metadata: | ||
| name: default | ||
| namespace: openshift-ingress-operator | ||
| spec: | ||
| replicas: 2 | ||
| endpointPublishingStrategy: | ||
| type: NodePortService | ||
| logging: | ||
| access: null | ||
| ---- | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.