user3117281
user3117281

Reputation: 61

Kubernetes pod logs retention

I have joined a project where we deploy our apps on Azure cloud. The apps are in docker containers orchestrated by kubernetes.

We get the data from a POD log file with this command (YAML code below)

kubectl logs --namespace=app-prod
deployment/app-fd-prod
> $(logFile)

where logFile is a variable

Now the problem is, yesterday the log file was 27MB. Today the log file is 2MB that means the old data got deleted some how.

I have read about logRotate but i dont think we have implemented that.

I want to know what can be the reason of deletion of yesterday's log file text ?

Any leads, helps would be appreciated.

Upvotes: 1

Views: 4658

Answers (1)

Keegan Cowle
Keegan Cowle

Reputation: 2469

pod logs get rotated for you as pointed out by @jordanm in the comments. You need a log aggregation tool like the ELK/EFK stack (Elastic + Logstash + kibana or Elastic + fluentd + kibana) or Promtail + loki + grafana. These stacks tail the logs of containers, do some fancy parsing / manipulation and ships it to persistent storage like S3.

Side note you can take a look at the logging operator that makes the config of these things a little easier.

Upvotes: 2

Related Questions