How to get to the end of the Kubernates containers log

1/9/2019

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?

-- Vikas Rathore
kubernetes

2 Answers

1/9/2019

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

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

-- Ami Hollander
Source: StackOverflow

1/9/2019

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.

-- Prafull Ladha
Source: StackOverflow