Clear a pod's log in kubernetes?

3/11/2020

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!

-- Wei Huang
kubernetes

1 Answer

3/11/2020

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).

-- coderanger
Source: StackOverflow