This documentation is for a release that is no longer maintained
See documentation for the latest supported version 3 or the latest supported version 4.8.2. 更新日志转发自定义资源
OpenShift Container Platform Log Forward API 已从 OpenShift Container Platform 4.6 中的技术预览提升为正式发布。GA 发行版本包含一些改进和增强,需要您更改 ClusterLogging
自定义资源(CR),并将 LogForwarding
自定义资源(CR)替换为 ClusterLogForwarder
CR。
OpenShift Container Platform 4.6 中的 ClusterLogForwarder
实例示例
OpenShift Container Platform 4.5 中的 ClusterLogForwarder
CR 示例
以下操作过程显示了您必须更改的每个参数。
流程
要将 4.5 中的 ClusterLogForwarder
CR 更新至 ClusterLogForwarding
CR 4.6,请进行以下修改:
编辑
ClusterLogging
自定义资源(CR)以删除logforwardingtechpreview
注解:ClusterLogging
CR 示例Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- 删除
logforwardingtechpreview
注解。
导出
ClusterLogForwarder
CR,为ClusterLogForwarder
实例创建一个 YAML 文件:oc get LogForwarding instance -n openshift-logging -o yaml| tee ClusterLogForwarder.yaml
$ oc get LogForwarding instance -n openshift-logging -o yaml| tee ClusterLogForwarder.yaml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 编辑 YAML 文件进行以下修改:
OpenShift Container Platform 4.6 中的
ClusterLogForwarder
实例示例Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- 将
apiVersion
从"logging.openshift.io/v1alpha1"
改为"logging.openshift.io/v1"
。 - 2
- 将对象类型从
kind: "LogForwarding"
改为kind: "ClusterLogForwarder"
。 - 3
- 删除
disableDefaultForwarding: true
参数。 - 4
- 将 output 参数从
spec.outputs.endpoint
改为spec.outputs.url
。如果 URL 没有前缀,请在 URL 中添加前缀,如https://
、tcp://
等。 - 5
- 对于 Fluentd 输出,请将
type
从forward
改为fluentdForward
。 - 6
- 更改管道:
-
将
spec.pipelines.inputSource
更改为spec.pipelines.inputRefs
-
将
logs.infra
改为infrastructure
-
将
logs.app
改为application
-
将
logs.audit
改为audit
-
将
- 7
- 可选:添加一个
default
管道来将日志发送到内部 Elasticsearch 实例。您不需要配置default
输出。注意如果您只希望将日志转发到内部 OpenShift Container Platform Elasticsearch 实例,请不要配置 Log Forwarding API。
创建 CR 对象。
oc create -f ClusterLogForwarder.yaml
$ oc create -f ClusterLogForwarder.yaml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
有关 Log Forwarding API 新功能的信息,请参阅将日志转发到第三方系统。