How to get to the end of the Kubernates containers log

Viewed 932

By running command kubectl logs pod -c container

I am getting continuous autoscrolling list of logs. Is there any way I can get to the end or see the latest log. I don't want go through all the logs.

I have tried using -f as well. Any suggestion?

2 Answers

According to kubectl logs --help you can use --tail

e.g. kubectl logs pod --tail=10

You have two ways to see the recent log files, based on number of lines and based on time:

kubectl logs --tail=20 nginx

It will show you 20 lines of most recent logs

kubectl logs --since=1h nginx

It will show you logs of last one hour.

Related