Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

kubernetes how to set the maximum size of the log file?

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?

like image 447
batazor Avatar asked Aug 18 '16 15:08

batazor


1 Answers

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
}
like image 119
Derek Chen Avatar answered Sep 26 '22 04:09

Derek Chen