mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 20:24:09 +00:00
Merge pull request #74502 from Random-Liu/collect-pod-log
Collect pod log in fluentd-gcp
This commit is contained in:
commit
a213886f9c
@ -413,6 +413,14 @@ if [[ -n "${LOGROTATE_MAX_SIZE:-}" ]]; then
|
|||||||
PROVIDER_VARS="${PROVIDER_VARS:-} LOGROTATE_MAX_SIZE"
|
PROVIDER_VARS="${PROVIDER_VARS:-} LOGROTATE_MAX_SIZE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ -n "${POD_LOG_MAX_FILE:-}" ]]; then
|
||||||
|
PROVIDER_VARS="${PROVIDER_VARS:-} POD_LOG_MAX_FILE"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -n "${POD_LOG_MAX_SIZE:-}" ]]; then
|
||||||
|
PROVIDER_VARS="${PROVIDER_VARS:-} POD_LOG_MAX_SIZE"
|
||||||
|
fi
|
||||||
|
|
||||||
# Fluentd requirements
|
# Fluentd requirements
|
||||||
# YAML exists to trigger a configuration refresh when changes are made.
|
# YAML exists to trigger a configuration refresh when changes are made.
|
||||||
FLUENTD_GCP_YAML_VERSION="v3.2.0"
|
FLUENTD_GCP_YAML_VERSION="v3.2.0"
|
||||||
|
@ -432,6 +432,14 @@ if [[ -n "${LOGROTATE_MAX_SIZE:-}" ]]; then
|
|||||||
PROVIDER_VARS="${PROVIDER_VARS:-} LOGROTATE_MAX_SIZE"
|
PROVIDER_VARS="${PROVIDER_VARS:-} LOGROTATE_MAX_SIZE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ -n "${POD_LOG_MAX_FILE:-}" ]]; then
|
||||||
|
PROVIDER_VARS="${PROVIDER_VARS:-} POD_LOG_MAX_FILE"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -n "${POD_LOG_MAX_SIZE:-}" ]]; then
|
||||||
|
PROVIDER_VARS="${PROVIDER_VARS:-} POD_LOG_MAX_SIZE"
|
||||||
|
fi
|
||||||
|
|
||||||
# Fluentd requirements
|
# Fluentd requirements
|
||||||
# YAML exists to trigger a configuration refresh when changes are made.
|
# YAML exists to trigger a configuration refresh when changes are made.
|
||||||
FLUENTD_GCP_YAML_VERSION="v3.2.0"
|
FLUENTD_GCP_YAML_VERSION="v3.2.0"
|
||||||
|
@ -374,6 +374,21 @@ function setup-logrotate() {
|
|||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
# Configure log rotation for pod logs in /var/log/pods/NAMESPACE_NAME_UID.
|
||||||
|
cat > /etc/logrotate.d/allpodlogs <<EOF
|
||||||
|
/var/log/pods/*/*.log {
|
||||||
|
rotate ${POD_LOG_MAX_FILE:-5}
|
||||||
|
copytruncate
|
||||||
|
missingok
|
||||||
|
notifempty
|
||||||
|
compress
|
||||||
|
maxsize ${POD_LOG_MAX_SIZE:-5M}
|
||||||
|
daily
|
||||||
|
dateext
|
||||||
|
dateformat -%Y%m%d-%s
|
||||||
|
create 0644 root root
|
||||||
|
}
|
||||||
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
# Finds the master PD device; returns it in MASTER_PD_DEVICE
|
# Finds the master PD device; returns it in MASTER_PD_DEVICE
|
||||||
|
Loading…
Reference in New Issue
Block a user