106. 如何禁用牧场主日志的注释收集
Environment 环境SUSE Rancher Prime - All versionsSUSE Rancher Prime - 所有版本Rancher-logging-105.3.xProcedure 程序There could be situations where users might want to disable annotation collection with rancher-logging in order to reduce the amount of data being transferred on the output.在某些情况下用户可能希望通过牧场日志关闭注释收集以减少输出中传输的数据量。Disabling annotation collection in the logs can be achieved by customising a record_transformer filter plugin in the ClusterFlow/Flow as shown in the example below:禁用日志中的注释收集可以通过在 ClusterFlow/Flow 中自定义 record_transformer 过滤器插件实现如下例所示apiVersion: logging.banzaicloud.io/v1beta1 kind: ClusterOutput metadata: name: test-output namespace: cattle-logging-system spec: file: path: /tmp/logs/${tag}/%Y/%m/%d/%H.%M buffer: timekey: 1m timekey_wait: 10s timekey_use_utc: true --- apiVersion: logging.banzaicloud.io/v1beta1 kind: ClusterFlow metadata: name: drop-annotations namespace: cattle-logging-system spec: filters: - record_transformer: remove_keys: $.kubernetes.annotations globalOutputRefs: - test-outputVerify that the annotations are not collected from the Fluentd logs. In the example shown above, the logs from path /tmp/logs/ stored inside rancher-logging-root-fluentd-0 pod can be reviewed. Below is an example of such log snippet that does not collect annotation:确认注释不是从 Fluentd 日志中收集的。在上述示例中可以查看存储在 rancher-logging-root-fluentd-0 pod 内的路径 /tmp/logs/ 日志。以下是不收集注释的此类对数片段示例2025-10-14T08:48:4500:00 kubernetes.var.log.containers.test-logging-pod_cattle-logging-system_sak-8ee60280b8735d9f14f81a7ce3fb4e58985da1cc419d2feb6ec0b1b8320b43a6.log {time:2025-10-14T08:48:45.108926277Z,stream:stdout,logtag:F,message:Hello World from Rancher Logging!,kubernetes:{pod_name:test-logging-pod,namespace_name:cattle-logging-system,pod_id:f4f2e04c-8fdf-4564-aad9-992071724ef2,labels:{logging-test:true,objectset.rio.cattle.io/hash:a933de1454495e4c5d41a35ca4b9cb9caf7f1181},host:abhishekh-do-abhishekh-do-rn7hx-9xwxt,container_name:sak,docker_id:8ee60280b8735d9f14f81a7ce3fb4e58985da1cc419d2feb6ec0b1b8320b43a6,container_hash:docker.io/rancherlabs/swiss-army-knifesha256:af25a3ace6269adb9e494b693644bc2f897ec872076d78f78bc5ded69f2ee222,container_image:docker.io/rancherlabs/swiss-army-knife:latest},kubernetes_namespace:{name:cattle-logging-system,labels:{kubernetes.io/metadata.name:cattle-logging-system}}}访问Rancher-K8S解决方案博主企业合作伙伴 https://blog.csdn.net/lidw2009
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/2473157.html
如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!