Log Tailing

Skaffold has built-in support for tailing logs for containers deployed by Skaffold on your cluster to your local machine when running in either dev, debug or run mode.

Log Structure

To view log structure, run skaffold run --tail on examples microserices

skaffold run --tail

will produce an output like this

logging-output

For, every log line, skaffold will prefix the pod name and container name if there not the same.

logging-output

In the above example, leeroy-web-75ff54dc77-9shwm is the pod name and leeroy-web is container name defined in the spec for this deployment

apiVersion: apps/v1
kind: Deployment
metadata:
  name: leeroy-web
  labels:
    app: leeroy-web
spec:
  replicas: 1
  selector:
    matchLabels:
      app: leeroy-web
  template:
    metadata:
      labels:
        app: leeroy-web
    spec:
      containers:
        - name: leeroy-web
          image: gcr.io/k8s-skaffold/leeroy-web
          ports:
            - containerPort: 8080 

Skaffold will choose a unique color for each container to make it easy for users to read the logs.

Last modified November 5, 2019: review comments (04070e072)