How to set the maximum size of the log file? Or enable log rotation. In the documentation I have not found anything about this.
Or it is necessary to write a script for this?
How to set the maximum size of the log file? Or enable log rotation. In the documentation I have not found anything about this.
Or it is necessary to write a script for this?
I don't think kubernetes provides log rotation feature now. You can put logrotate configuration in your host machine. Something like this one:
/var/lib/docker/containers/*/*.log {
rotate 7
daily
size=10M
compress
missingok
delaycompress
copytruncate
}
© 2022 - 2024 — McMap. All rights reserved.
SSH $user@$node "sudo truncate -s 0 /var/lib/Docker/containers/$id/$id-json.log"
But I have not tested it fully – Polyzoan