|
1 | 1 | // Module included in the following assemblies:
|
2 | 2 | //
|
3 |
| -// * observability/logging/log_collection_forwarding/configuring-log-forwarding.adoc |
| 3 | +// * configuring/configuring-log-forwarding.adoc |
| 4 | + |
| 5 | +//https://github.com/openshift/cluster-logging-operator/blob/master/docs/features/logforwarding/outputs/cloudwatch-sts-forwarding.adoc |
4 | 6 |
|
5 | 7 | :_mod-docs-content-type: PROCEDURE
|
6 | 8 | [id="cluster-logging-collector-log-forward-sts-cloudwatch_{context}"]
|
7 |
| -= Forwarding logs to Amazon CloudWatch from STS enabled clusters |
| 9 | += Forwarding logs to Amazon CloudWatch from STS-enabled clusters |
8 | 10 |
|
9 |
| -For clusters with AWS Security Token Service (STS) enabled, you can create an AWS service account manually or create a credentials request by using the Cloud Credential Operator (CCO) utility `ccoctl`. |
| 11 | +You can forward logs from {logging-title} deployed on clusters with {aws-first} {sts-first}-enabled to Amazon CloudWatch. Amazon CloudWatch is a service that helps administrators observe and monitor resources and applications on {aws-short}. |
10 | 12 |
|
11 | 13 | .Prerequisites
|
12 | 14 |
|
13 |
| -* {logging-title-uc}: 5.5 and later |
| 15 | +* {clo} has been installed. |
| 16 | +* You have configured a credential secret. |
| 17 | +* You have administrator access to {product-title}. |
14 | 18 |
|
15 | 19 | .Procedure
|
16 | 20 |
|
17 |
| -. Create a `CredentialsRequest` custom resource YAML by using the template below: |
| 21 | +* Create or update a `ClusterLogForwarder` custom resource (CR): |
18 | 22 | +
|
19 |
| -.CloudWatch credentials request template |
20 | 23 | [source,yaml]
|
21 | 24 | ----
|
22 |
| -apiVersion: cloudcredential.openshift.io/v1 |
23 |
| -kind: CredentialsRequest |
24 |
| -metadata: |
25 |
| - name: <your_role_name>-credrequest |
26 |
| - namespace: openshift-cloud-credential-operator |
27 |
| -spec: |
28 |
| - providerSpec: |
29 |
| - apiVersion: cloudcredential.openshift.io/v1 |
30 |
| - kind: AWSProviderSpec |
31 |
| - statementEntries: |
32 |
| - - action: |
33 |
| - - logs:PutLogEvents |
34 |
| - - logs:CreateLogGroup |
35 |
| - - logs:PutRetentionPolicy |
36 |
| - - logs:CreateLogStream |
37 |
| - - logs:DescribeLogGroups |
38 |
| - - logs:DescribeLogStreams |
39 |
| - effect: Allow |
40 |
| - resource: arn:aws:logs:*:*:* |
41 |
| - secretRef: |
42 |
| - name: <your_role_name> |
43 |
| - namespace: openshift-logging |
44 |
| - serviceAccountNames: |
45 |
| - - logcollector |
46 |
| ----- |
47 |
| -+ |
48 |
| -. Use the `ccoctl` command to create a role for AWS using your `CredentialsRequest` CR. With the `CredentialsRequest` object, this `ccoctl` command creates an IAM role with a trust policy that is tied to the specified OIDC identity provider, and a permissions policy that grants permissions to perform operations on CloudWatch resources. This command also creates a YAML configuration file in `/<path_to_ccoctl_output_dir>/manifests/openshift-logging-<your_role_name>-credentials.yaml`. This secret file contains the `role_arn` key/value used during authentication with the AWS IAM identity provider. |
49 |
| -+ |
50 |
| -[source,terminal] |
51 |
| ----- |
52 |
| -$ ccoctl aws create-iam-roles \ |
53 |
| ---name=<name> \ |
54 |
| ---region=<aws_region> \ |
55 |
| ---credentials-requests-dir=<path_to_directory_with_list_of_credentials_requests>/credrequests \ |
56 |
| ---identity-provider-arn=arn:aws:iam::<aws_account_id>:oidc-provider/<name>-oidc.s3.<aws_region>.amazonaws.com <1> |
57 |
| ----- |
58 |
| -<1> <name> is the name used to tag your cloud resources and should match the name used during your STS cluster install |
59 |
| -+ |
60 |
| -. Apply the secret created: |
61 |
| -[source,terminal] |
62 |
| -+ |
63 |
| ----- |
64 |
| -$ oc apply -f output/manifests/openshift-logging-<your_role_name>-credentials.yaml |
65 |
| ----- |
66 |
| -+ |
67 |
| -. Create or edit a `ClusterLogForwarder` custom resource: |
68 |
| -+ |
69 |
| -[source,yaml] |
70 |
| ----- |
71 |
| -apiVersion: logging.openshift.io/v1 |
| 25 | +apiVersion: observability.openshift.io/v1 |
72 | 26 | kind: ClusterLogForwarder
|
73 | 27 | metadata:
|
74 |
| - name: <log_forwarder_name> <1> |
75 |
| - namespace: <log_forwarder_namespace> <2> |
| 28 | + name: <log_forwarder_name> |
| 29 | + namespace: openshift-logging |
76 | 30 | spec:
|
77 |
| - serviceAccountName: clf-collector <3> |
| 31 | + serviceAccount: |
| 32 | + name: <service_account_name> #<1> |
78 | 33 | outputs:
|
79 |
| - - name: cw <4> |
80 |
| - type: cloudwatch <5> |
| 34 | + - name: cw-output #<2> |
| 35 | + type: cloudwatch #<3> |
81 | 36 | cloudwatch:
|
82 |
| - groupBy: logType <6> |
83 |
| - groupPrefix: <group prefix> <7> |
84 |
| - region: us-east-2 <8> |
85 |
| - secret: |
86 |
| - name: <your_secret_name> <9> |
| 37 | + groupName: 'cw-projected{.log_type||"missing"}' #<4> |
| 38 | + region: us-east-2 #<5> |
| 39 | + authentication: |
| 40 | + type: iamRole #<6> |
| 41 | + iamRole: |
| 42 | + roleARN: #<7> |
| 43 | + key: role_arn |
| 44 | + secretName: sts-secret |
| 45 | + token: #<8> |
| 46 | + from: serviceAccount |
87 | 47 | pipelines:
|
88 |
| - - name: to-cloudwatch <10> |
89 |
| - inputRefs: <11> |
| 48 | + - name: to-cloudwatch |
| 49 | + inputRefs: #<9> |
90 | 50 | - infrastructure
|
91 | 51 | - audit
|
92 | 52 | - application
|
93 |
| - outputRefs: |
94 |
| - - cw <12> |
| 53 | + outputRefs: #<10> |
| 54 | + - cw-output |
95 | 55 | ----
|
96 |
| -<1> In legacy implementations, the CR name must be `instance`. In multi log forwarder implementations, you can use any name. |
97 |
| -<2> In legacy implementations, the CR namespace must be `openshift-logging`. In multi log forwarder implementations, you can use any namespace. |
98 |
| -<3> Specify the `clf-collector` 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. |
99 |
| -<4> Specify a name for the output. |
100 |
| -<5> Specify the `cloudwatch` type. |
101 |
| -<6> Optional: Specify how to group the logs: |
102 |
| -+ |
103 |
| -* `logType` creates log groups for each log type. |
104 |
| -* `namespaceName` creates a log group for each application name space. Infrastructure and audit logs are unaffected, remaining grouped by `logType`. |
105 |
| -* `namespaceUUID` creates a new log groups for each application namespace UUID. It also creates separate log groups for infrastructure and audit logs. |
106 |
| -<7> Optional: Specify a string to replace the default `infrastructureName` prefix in the names of the log groups. |
107 |
| -<8> Specify the AWS region. |
108 |
| -<9> Specify the name of the secret that contains your AWS credentials. |
109 |
| -<10> Optional: Specify a name for the pipeline. |
110 |
| -<11> Specify which log types to forward by using the pipeline: `application,` `infrastructure`, or `audit`. |
111 |
| -<12> Specify the name of the output to use when forwarding logs with this pipeline. |
| 56 | +<1> Specify the service account. |
| 57 | +<2> Specify a name for the output. |
| 58 | +<3> Specify the `cloudwatch` type. |
| 59 | +<4> Specify the group name for the log stream. |
| 60 | +<5> Specify the AWS region. |
| 61 | +<6> Specify `iamRole` as the authentication type for STS. |
| 62 | +<7> Specify the name of the secret and the key where the `role_arn` resource is stored. |
| 63 | +<8> Specify the service account token to use for authentication. To use the projected service account token, use `from: serviceAccount`. |
| 64 | +<9> Specify which log types to forward by using the pipeline: `application,` `infrastructure`, or `audit`. |
| 65 | +<10> Specify the names of the output to use when forwarding logs with this pipeline. |
0 commit comments