Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Clear a pod's log in kubernetes?

Tags:

kubernetes

How could I clear existing log of a specific pod?

So that I can get all logs since that time with kubectl logs next time.

Thanks!

like image 496
Wei Huang Avatar asked Mar 11 '20 06:03

Wei Huang


1 Answers

You can't, the log rotation is generally implemented in Docker (or sometimes via logrotate on the node host). However you can use kubectl logs --since-time and fill in the time of your last get. If you're trying to build something to iteratively process logs automatically, probably use Fluentd to load them into some kind of database (Kafka is common for this).

like image 79
coderanger Avatar answered Sep 23 '22 01:09

coderanger