|
| 1 | +// Module included in the following assemblies: |
| 2 | +// cluster-logging-external.adoc |
| 3 | +// |
| 4 | + |
| 5 | +:_content-type: PROCEDURE |
| 6 | +[id="cluster-logging-collector-log-forward-gcp_{context}"] |
| 7 | += Forwarding logs to Google Cloud Platform (GCP) |
| 8 | + |
| 9 | +You can forward logs to link:https://cloud.google.com/logging/docs/basic-concepts[Google Cloud Logging] in addition to, or instead of, the internal default {product-title} log store. |
| 10 | + |
| 11 | +[NOTE] |
| 12 | +==== |
| 13 | +Using this feature with Fluentd is not supported. |
| 14 | +==== |
| 15 | + |
| 16 | +.Prerequisites |
| 17 | +* {logging-title-uc} Operator 5.5.1 and later |
| 18 | +
|
| 19 | +.Procedure |
| 20 | + |
| 21 | +. Create a secret using your link:https://cloud.google.com/iam/docs/creating-managing-service-account-keys[Google service account key]. |
| 22 | ++ |
| 23 | +[source,terminal,subs="+quotes"] |
| 24 | +---- |
| 25 | +$ oc -n openshift-logging create secret generic gcp-secret --from-file google-application-credentials.json=_<your_service_account_key_file.json>_ |
| 26 | +---- |
| 27 | +. Create a `ClusterLogForwarder` Custom Resource YAML using the template below: |
| 28 | ++ |
| 29 | +[source,yaml] |
| 30 | +---- |
| 31 | +apiVersion: "logging.openshift.io/v1" |
| 32 | +kind: "ClusterLogForwarder" |
| 33 | +metadata: |
| 34 | + name: "instance" |
| 35 | + namespace: "openshift-logging" |
| 36 | +spec: |
| 37 | + outputs: |
| 38 | + - name: gcp-1 |
| 39 | + type: googleCloudLogging |
| 40 | + secret: |
| 41 | + name: gcp-secret |
| 42 | + googleCloudLogging: |
| 43 | + projectId : "openshift-gce-devel" <1> |
| 44 | + logId : "app-gcp" <2> |
| 45 | + pipelines: |
| 46 | + - name: test-app |
| 47 | + inputRefs: <3> |
| 48 | + - application |
| 49 | + outputRefs: |
| 50 | + - gcp-1 |
| 51 | +---- |
| 52 | +<1> Set either a `projectId`, `folderId`, `organizationId`, or `billingAccountId` field and its corresponding value, depending on where you want to store your logs in the link:https://cloud.google.com/resource-manager/docs/cloud-platform-resource-hierarchy[GCP resource hierarchy]. |
| 53 | +<2> Set the value to add to the `logName` field of the link:https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry[Log Entry]. |
| 54 | +<3> Specify which log types to forward by using the pipeline: `application`, `infrastructure`, or `audit`. |
| 55 | + |
| 56 | +[role="_additional-resources"] |
| 57 | +.Additional resources |
| 58 | +* link:https://cloud.google.com/billing/docs/concepts[Google Cloud Billing Documentation] |
| 59 | +* link:https://cloud.google.com/logging/docs/view/logging-query-language[Google Cloud Logging Query Language Documentation] |
0 commit comments