本文永久链接: https://www.xtplayer.cn/rancher/rancher-2-6-logging-output-alyun-oss-example/

参考 https://kube-logging.dev/docs/configuration/plugins/outputs/secret/ 创建授权密文

apiVersion: v1
kind: Secret
type: Opaque
metadata:
annotations:
logging.banzaicloud.io/default: watched
name: oss-auth-secret
namespace: cattle-logging-system
data:
username: <base64 加密>
password: <base64 加密>
  1. 创建 ClusterOutput,oss 插件配置参数参考 https://kube-logging.dev/docs/configuration/plugins/outputs/oss/ ,buffer 配置参数参考 https://kube-logging.dev/docs/configuration/plugins/outputs/buffer/#buffer
apiVersion: logging.banzaicloud.io/v1beta1
kind: ClusterOutput
metadata:
name: oss-clusteroutput
annotations:
labels:
namespace: cattle-logging-system
spec:
oss:
endpoint: <aliyun-oss-url>
aaccess_key_secret:
mountFrom:
secretKeyRef:
key: password
name: oss-auth-secret
access_key_id:
mountFrom:
secretKeyRef:
key: username
name: oss-auth-secret
auto_create_bucket: true
bucket: rancher-logging-bucket
buffer:
type: file
# chunk_full_threshold: string
# chunk_limit_records: int
chunk_limit_size: 8M
# compress: string
# delayed_commit_timeout: string
# disable_chunk_backup: boolean
# disabled: boolean
# flush_at_shutdown: boolean
flush_interval: 1s
flush_mode: interval
# flush_thread_burst_interval: string
flush_thread_count: 8
# flush_thread_interval: string
# overflow_action: string
# path: /var/log/fluent/oss
# queue_limit_length: int
queued_chunks_limit_size: 10
# retry_exponential_backoff_base: string
retry_forever: true
# retry_max_interval: string
# retry_max_times: int
# retry_randomize: boolean
# retry_secondary_threshold: string
# retry_timeout: string
# retry_type: string
# retry_wait: string
# tags: string
# timekey: 60
# timekey_use_utc: true
# timekey_wait: 20s
# timekey_zone: string
total_limit_size: 50GB
check_bucket: true
check_object: true
download_crc_enable: true
#format:
# type: string
# add_newline: boolean
# message_key: string
hex_random_length: 4
index_format: "%d"
key_format: "%{path}/%{time_slice}_%{index}_%{thread_id}.%{file_extension}"
open_timeout: 10
oss_sdk_log_dir: /var/log/td-agent
overwrite: false
path: fluent/logs
read_timeout: 120
store_as: gzip
upload_crc_enable: true
#warn_for_delay: string
slow_flush_log_threshold: 20.0
__clone: true