DELAPARRA
Index
Color
NL
Category: Kubernetes

logs

Explained by Updated

What is logs?

logs: Print a container's stdout/stderr. Add -f to follow, --previous to see the crashed container's logs. kubectl logs shows what a container wrote to its standard output and error streams. kubectl logs web-7d9f8c prints the logs of that pod, and -f keeps following new lines as they arrive. --previous is the option people miss most. When a container crashes and restarts, the logs of the crashed instance explain why, and --previous shows exactly those.

Definition source Coders Lingo, CC BY 4.0

Frequently asked questions about logs

What should you keep in mind with logs?

For a pod with several containers, choose one with -c. kubectl logs deploy/web picks a pod from a Deployment for you, and -l app=web shows logs from all matching pods. Kubernetes keeps only recent logs and loses them when a pod is deleted, so for anything you may need later, ship logs to a central system such as Loki or another logging service.

What does an example of logs look like?

kubectl logs -f web-7d9f8c-abc12 kubectl logs web-7d9f8c-abc12 --previous

At a glance

CategoryKubernetes
Explained by
Updated

More Kubernetes terms

All terms starting with L

Skills

Download all skills (zip)

Manuals

Related services

Need any help?

Stuck on one of these in your own project? Tell me what you are working on and I will tell you how I would approach it.