-
Notifications
You must be signed in to change notification settings - Fork 1.8k
config-log-forwarding-3 #94412
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
base: standalone-logging-docs-main
Are you sure you want to change the base?
config-log-forwarding-3 #94412
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,8 +2,6 @@ | |
[id="cluster-logging-collector-log-forward-cloudwatch_{context}"] | ||
= Forwarding logs to Amazon CloudWatch | ||
|
||
You can forward logs to Amazon CloudWatch, a monitoring and log storage service hosted by Amazon Web Services (AWS). You can forward logs to CloudWatch in addition to, or instead of, the default log store. | ||
|
||
To configure log forwarding to CloudWatch, you must create a `ClusterLogForwarder` custom resource (CR) with an output for CloudWatch, and a pipeline that uses the output. | ||
|
||
.Procedure | ||
|
@@ -33,47 +31,43 @@ $ oc apply -f cw-secret.yaml | |
+ | ||
[source,yaml] | ||
---- | ||
apiVersion: logging.openshift.io/v1 | ||
apiVersion: observability.openshift.io/v1 | ||
kind: ClusterLogForwarder | ||
metadata: | ||
name: <log_forwarder_name> <1> | ||
namespace: <log_forwarder_namespace> <2> | ||
name: <log_forwarder_name> | ||
namespace: <log_forwarder_namespace> | ||
spec: | ||
serviceAccountName: <service_account_name> <3> | ||
serviceAccountName: | ||
name: <service_account_name> <1> | ||
outputs: | ||
- name: cw <4> | ||
type: cloudwatch <5> | ||
- name: cw <2> | ||
type: cloudwatch <3> | ||
cloudwatch: | ||
groupBy: logType <6> | ||
groupPrefix: <group prefix> <7> | ||
region: us-east-2 <8> | ||
secret: | ||
name: cw-secret <9> | ||
authentication: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. indentation: |
||
awsAccessKey: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. missing |
||
keyId: | ||
key: <key> | ||
secretName: cw-secret <4> | ||
groupName: logType <5> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This api has changed from
|
||
region: us-east-2 <6> | ||
pipelines: | ||
- name: infra-logs <10> | ||
inputRefs: <11> | ||
- name: infra-logs <7> | ||
inputRefs: <8> | ||
- infrastructure | ||
- audit | ||
- application | ||
outputRefs: | ||
- cw <12> | ||
---- | ||
<1> In legacy implementations, the CR name must be `instance`. In multi log forwarder implementations, you can use any name. | ||
<2> In legacy implementations, the CR namespace must be `openshift-logging`. In multi log forwarder implementations, you can use any namespace. | ||
<3> The name of your service account. The service account is only required in multi log forwarder implementations if the log forwarder is not deployed in the `openshift-logging` namespace. | ||
<4> Specify a name for the output. | ||
<5> Specify the `cloudwatch` type. | ||
<6> Optional: Specify how to group the logs: | ||
+ | ||
* `logType` creates log groups for each log type. | ||
* `namespaceName` creates a log group for each application name space. It also creates separate log groups for infrastructure and audit logs. | ||
* `namespaceUUID` creates a new log groups for each application namespace UUID. It also creates separate log groups for infrastructure and audit logs. | ||
<7> Optional: Specify a string to replace the default `infrastructureName` prefix in the names of the log groups. | ||
<8> Specify the AWS region. | ||
<9> Specify the name of the secret that contains your AWS credentials. | ||
<10> Optional: Specify a name for the pipeline. | ||
<11> Specify which log types to forward by using the pipeline: `application,` `infrastructure`, or `audit`. | ||
<12> Specify the name of the output to use when forwarding logs with this pipeline. | ||
- cw <9> | ||
---- | ||
<1> The name of your service account. | ||
<2> Specify a name for the output. | ||
<3> Specify the `cloudwatch` type. | ||
<4> Specify the name of the secret that contains your AWS credentials. | ||
<5> Specify the strategy for grouping logstreams. The `GroupName` can be a combination of static and dynamic values consisting of field paths followed by "\|\|" followed by another field path or a static value. A dynamic value is encased in single curly brackets "{}" and must end with a static fallback value separated with `\|\|`. | ||
<6> Specify the AWS region. | ||
<7> Specify a name for the pipeline. | ||
<8> Specify which log types to forward by using the pipeline: `application,` `infrastructure`, or `audit`. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same |
||
<9> Specify the name of the output to use when forwarding logs with this pipeline. | ||
|
||
. Create the CR object: | ||
+ | ||
|
@@ -121,11 +115,12 @@ $ oc get ns/app -ojson | jq .metadata.uid | |
"794e1e1a-b9f5-4958-a190-e76a9b53d7bf" | ||
---- | ||
|
||
|
||
In your `ClusterLogForwarder` custom resource (CR), you configure the `infrastructure`, `audit`, and `application` log types as inputs to the `all-logs` pipeline. You also connect this pipeline to `cw` output, which forwards the logs to a CloudWatch instance in the `us-east-2` region: | ||
|
||
[source,yaml] | ||
---- | ||
apiVersion: "logging.openshift.io/v1" | ||
apiVersion: observability.openshift.io/v1 | ||
kind: ClusterLogForwarder | ||
metadata: | ||
name: instance | ||
|
@@ -135,10 +130,12 @@ spec: | |
- name: cw | ||
type: cloudwatch | ||
cloudwatch: | ||
groupBy: logType | ||
authentication: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. indent all this, and it's missing |
||
awsAccessKey: | ||
keyId: | ||
key: <key> | ||
secretName: cw-secret | ||
region: us-east-2 | ||
secret: | ||
name: cw-secret | ||
pipelines: | ||
- name: all-logs | ||
inputRefs: | ||
|
@@ -155,7 +152,7 @@ Each region in CloudWatch contains three levels of objects: | |
** log stream | ||
*** log event | ||
|
||
|
||
//// | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jcantrill, i did not finf
Is this content still correct? |
||
With `groupBy: logType` in the `ClusterLogForwarding` CR, the three log types in the `inputRefs` produce three log groups in Amazon Cloudwatch: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. With |
||
|
||
[source,terminal] | ||
|
@@ -290,3 +287,4 @@ $ aws --output json logs describe-log-groups | jq .logGroups[].logGroupName | |
---- | ||
|
||
The `groupBy` field affects the application log group only. It does not affect the `audit` and `infrastructure` log groups. | ||
//// | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Any info in the lines above referencing |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,8 +6,6 @@ | |
[id="cluster-logging-collector-log-forward-loki_{context}"] | ||
= Forwarding logs to an external Loki logging system | ||
|
||
You can forward logs to an external Loki logging system in addition to, or instead of, the default log store. | ||
|
||
To configure log forwarding to Loki, you must create a `ClusterLogForwarder` custom resource (CR) with an output to Loki, and a pipeline that uses the output. The output to Loki can use the HTTP (insecure) or HTTPS (secure HTTP) connection. | ||
|
||
.Prerequisites | ||
|
@@ -20,51 +18,54 @@ To configure log forwarding to Loki, you must create a `ClusterLogForwarder` cus | |
+ | ||
[source,yaml] | ||
---- | ||
apiVersion: logging.openshift.io/v1 | ||
apiVersion: observability.openshift.io/v1 | ||
kind: ClusterLogForwarder | ||
metadata: | ||
name: <log_forwarder_name> <1> | ||
namespace: <log_forwarder_namespace> <2> | ||
name: <log_forwarder_name> | ||
namespace: <log_forwarder_namespace> | ||
spec: | ||
serviceAccountName: <service_account_name> <3> | ||
serviceAccountName: | ||
name: <service_account_name> #<1> | ||
outputs: | ||
- name: loki-insecure <4> | ||
type: "loki" <5> | ||
url: http://loki.insecure.com:3100 <6> | ||
loki: | ||
tenantKey: kubernetes.namespace_name | ||
- name: loki-insecure #<2> | ||
type: loki #<3> | ||
loki: | ||
url: http://loki.insecure.com:3100 #<4> | ||
labelKeys: | ||
- kubernetes.labels.foo | ||
- name: loki-secure <7> | ||
type: "loki" | ||
url: https://loki.secure.com:3100 | ||
secret: | ||
name: loki-secret <8> | ||
- kubernetes.labels.foo | ||
tenantKey: kubernetes.namespace_name | ||
- name: loki-secure #<5> | ||
type: loki | ||
loki: | ||
tenantKey: kubernetes.namespace_name <9> | ||
authentication: | ||
token: | ||
from: <secret_or_serviceAccount> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. indent under token |
||
secret: #<6> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this spec has changed in v6. The example should likely be |
||
key: <secret_key> | ||
name: loki-secret | ||
labelKeys: | ||
- kubernetes.labels.foo <10> | ||
- kubernetes.labels.foo #<7> | ||
tenantKey: kubernetes.namespace_name #<8> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is now a template and combination of static and dynamic values inside curly brackets (with a static fallback) |
||
url: https://loki.secure.com:3100 | ||
pipelines: | ||
- name: application-logs <11> | ||
inputRefs: <12> | ||
- name: my-pipeline | ||
inputRefs: #<9> | ||
- application | ||
- audit | ||
outputRefs: <13> | ||
outputRefs: #<10> | ||
- loki-secure | ||
---- | ||
<1> In legacy implementations, the CR name must be `instance`. In multi log forwarder implementations, you can use any name. | ||
<2> In legacy implementations, the CR namespace must be `openshift-logging`. In multi log forwarder implementations, you can use any namespace. | ||
<3> The name of your service account. The service account is only required in multi log forwarder implementations if the log forwarder is not deployed in the `openshift-logging` namespace. | ||
<4> Specify a name for the output. | ||
<5> Specify the type as `"loki"`. | ||
<6> Specify the URL and port of the Loki system as a valid absolute URL. You can use the `http` (insecure) or `https` (secure HTTP) protocol. If the cluster-wide proxy using the CIDR annotation is enabled, the output must be a server name or FQDN, not an IP Address. Loki's default port for HTTP(S) communication is 3100. | ||
<7> For a secure connection, you can specify an `https` or `http` URL that you authenticate by specifying a `secret`. | ||
<8> For an `https` prefix, specify the name of the secret required by the endpoint for TLS communication. The secret must contain a `ca-bundle.crt` key that points to the certificates it represents. Otherwise, for `http` and `https` prefixes, you can specify a secret that contains a username and password. In legacy implementations, the secret must exist in the `openshift-logging` project. For more information, see the following "Example: Setting a secret that contains a username and password." | ||
<9> Optional: Specify a metadata key field to generate values for the `TenantID` field in Loki. For example, setting `tenantKey: kubernetes.namespace_name` uses the names of the Kubernetes namespaces as values for tenant IDs in Loki. To see which other log record fields you can specify, see the "Log Record Fields" link in the following "Additional resources" section. | ||
<10> Optional: Specify a list of metadata field keys to replace the default Loki labels. Loki label names must match the regular expression `[a-zA-Z_:][a-zA-Z0-9_:]*`. Illegal characters in metadata keys are replaced with `_` to form the label name. For example, the `kubernetes.labels.foo` metadata key becomes Loki label `kubernetes_labels_foo`. If you do not set `labelKeys`, the default value is: `[log_type, kubernetes.namespace_name, kubernetes.pod_name, kubernetes_host]`. Keep the set of labels small because Loki limits the size and number of labels allowed. See link:https://grafana.com/docs/loki/latest/configuration/#limits_config[Configuring Loki, limits_config]. You can still query based on any log record field using query filters. | ||
<11> Optional: Specify a name for the pipeline. | ||
<12> Specify which log types to forward by using the pipeline: `application,` `infrastructure`, or `audit`. | ||
<13> Specify the name of the output to use when forwarding logs with this pipeline. | ||
<1> The name of your service account. The service account is only required in multi log forwarder implementations if the log forwarder is not deployed in the `openshift-logging` namespace. | ||
<2> Specify a name for the output. | ||
<3> Specify the type as `loki`. | ||
<4> Specify the URL and port of the Loki system as a valid absolute URL. You can use the `http` (insecure) or `https` (secure HTTP) protocol. If the cluster-wide proxy using the CIDR annotation is enabled, the output must be a server name or FQDN, not an IP Address. Loki's default port for HTTP(S) communication is 3100. | ||
<5> For a secure connection, you can specify an `https` or `http` URL that you authenticate by specifying a `secret`. | ||
<6> For an `https` prefix, specify the name of the secret required by the endpoint for TLS communication. The secret must contain a `ca-bundle.crt` key that points to the certificates it represents. Otherwise, for `http` and `https` prefixes, you can specify a secret that contains a username and password. In legacy implementations, the secret must exist in the `openshift-logging` project. For more information, see the following "Example: Setting a secret that contains a username and password." | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. tls is now its own spec and no longer looks for specific keys |
||
<7> Optional: Specify a metadata key field to generate values for the `TenantID` field in Loki. For example, setting `tenantKey: kubernetes.namespace_name` uses the names of the Kubernetes namespaces as values for tenant IDs in Loki. To see which other log record fields you can specify, see the "Log Record Fields" link in the following "Additional resources" section. | ||
<8> Optional: Specify a list of metadata field keys to replace the default Loki labels. Loki label names must match the regular expression `[a-zA-Z_:][a-zA-Z0-9_:]*`. Illegal characters in metadata keys are replaced with `_` to form the label name. For example, the `kubernetes.labels.foo` metadata key becomes Loki label `kubernetes_labels_foo`. If you do not set `labelKeys`, the default value is: `[log_type, kubernetes.namespace_name, kubernetes.pod_name, kubernetes_host]`. Keep the set of labels small because Loki limits the size and number of labels allowed. See link:https://grafana.com/docs/loki/latest/configuration/#limits_config[Configuring Loki, limits_config]. You can still query based on any log record field using query filters. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is now a template, so this needs to be rewritten. |
||
<9> Specify which log types to forward by using the pipeline: `application,` `infrastructure`, or `audit`. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same |
||
<10> Specify the name of the output to use when forwarding logs with this pipeline. | ||
|
||
+ | ||
[NOTE] | ||
==== | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in v6 we require 3 or more chars for a name. Probably best to find a new example name.