1.8. 将日志转发到 Google Cloud Platform (GCP)
您可以将日志转发到 Google Cloud Logging。
重要
AWS 上的 Red Hat OpenShift 不支持将日志转发到 GCP。
先决条件
- 已安装 Red Hat OpenShift Logging Operator。
流程
使用 Google 服务帐户密钥创建 secret。
$ oc -n openshift-logging create secret generic gcp-secret --from-file google-application-credentials.json=<your_service_account_key_file.json>使用以下模板创建
ClusterLogForwarder自定义资源 YAML:apiVersion: observability.openshift.io/v1 kind: ClusterLogForwarder metadata: name: <log_forwarder_name> namespace: openshift-logging spec: serviceAccount: name: <service_account_name>1 outputs: - name: gcp-1 type: googleCloudLogging googleCloudLogging: authentication: credentials: secretName: gcp-secret key: google-application-credentials.json id: type : project value: openshift-gce-devel2 logId : app-gcp3 pipelines: - name: test-app inputRefs:4 - application outputRefs: - gcp-1