File tree Expand file tree Collapse file tree 3 files changed +31
-0
lines changed Expand file tree Collapse file tree 3 files changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -413,6 +413,14 @@ if [[ -n "${LOGROTATE_MAX_SIZE:-}" ]]; then
413
413
PROVIDER_VARS=" ${PROVIDER_VARS:- } LOGROTATE_MAX_SIZE"
414
414
fi
415
415
416
+ if [[ -n " ${POD_LOG_MAX_FILE:- } " ]]; then
417
+ PROVIDER_VARS=" ${PROVIDER_VARS:- } POD_LOG_MAX_FILE"
418
+ fi
419
+
420
+ if [[ -n " ${POD_LOG_MAX_SIZE:- } " ]]; then
421
+ PROVIDER_VARS=" ${PROVIDER_VARS:- } POD_LOG_MAX_SIZE"
422
+ fi
423
+
416
424
# Fluentd requirements
417
425
# YAML exists to trigger a configuration refresh when changes are made.
418
426
FLUENTD_GCP_YAML_VERSION=" v3.2.0"
Original file line number Diff line number Diff line change @@ -432,6 +432,14 @@ if [[ -n "${LOGROTATE_MAX_SIZE:-}" ]]; then
432
432
PROVIDER_VARS=" ${PROVIDER_VARS:- } LOGROTATE_MAX_SIZE"
433
433
fi
434
434
435
+ if [[ -n " ${POD_LOG_MAX_FILE:- } " ]]; then
436
+ PROVIDER_VARS=" ${PROVIDER_VARS:- } POD_LOG_MAX_FILE"
437
+ fi
438
+
439
+ if [[ -n " ${POD_LOG_MAX_SIZE:- } " ]]; then
440
+ PROVIDER_VARS=" ${PROVIDER_VARS:- } POD_LOG_MAX_SIZE"
441
+ fi
442
+
435
443
# Fluentd requirements
436
444
# YAML exists to trigger a configuration refresh when changes are made.
437
445
FLUENTD_GCP_YAML_VERSION=" v3.2.0"
Original file line number Diff line number Diff line change @@ -374,6 +374,21 @@ function setup-logrotate() {
374
374
}
375
375
EOF
376
376
377
+ # Configure log rotation for pod logs in /var/log/pods/NAMESPACE_NAME_UID.
378
+ cat > /etc/logrotate.d/allpodlogs << EOF
379
+ /var/log/pods/*/*.log {
380
+ rotate ${POD_LOG_MAX_FILE:- 5}
381
+ copytruncate
382
+ missingok
383
+ notifempty
384
+ compress
385
+ maxsize ${POD_LOG_MAX_SIZE:- 5M}
386
+ daily
387
+ dateext
388
+ dateformat -%Y%m%d-%s
389
+ create 0644 root root
390
+ }
391
+ EOF
377
392
}
378
393
379
394
# Finds the master PD device; returns it in MASTER_PD_DEVICE
You can’t perform that action at this time.
0 commit comments