Kubernetes Logging

Get started with Kubernetes log files. Learn how to deploy, and collect, ingest, monitor, search, and analyze Kubernetes logs for simplified, centralized log management and analysis.

Setup

Ship log files from your Kubernetes v1.2+ cluster. To enable Kubernetes logging, run the following commands. Be sure to replace YOUR-INGESTION-KEY-HERE with your LogDNA Ingestion Key.

kubectl create secret generic logdna-agent-key --from-literal=logdna-agent-key=YOUR-INGESTION-KEY-HERE
kubectl create -f https://raw.githubusercontent.com/logdna/logdna-agent/master/logdna-agent-ds.yaml

This automatically installs a logdna-agent pod into each node in your cluster and ships stdout/stderr from all containers, both application logs and node logs. Note: By default, the agent pod will collect logs from all namespaces on each node, including kube-system. View your logs at app.logdna.com.

Usage

We extract pertinent Kubernetes metadata: pod name, container name, container id, namespace and display them inside the line context menu. You can search directly for logs matching these properties by clicking on them in the context menu or using our field search syntax:

namespace:my-namespace

Once logs are flowing into LogDNA, you'll also see a meta container simply named POD which shows container terminations. You can find under the Apps dropdown.

Kubernetes Compliance

In order to keep in compliance with Kubernetes production environment standards, all Kubernetes logs should be logged to STDOUT (Standard out) by default. If you are logging to a file, make sure you are also logging to STDOUT as well. Not logging to STDOUT inhibits Kubernetes nodes from dumping logs onto the host machine, which is where LogDNA reads from. Doing this can result in the inability to get logs from your Kubernetes deployment out and into LogDNA for viewing.

Additional Resources

Kubernetes Logging Guide
Kubernetes Logging Best Practices

Kubernetes Logging


Get started with Kubernetes log files. Learn how to deploy, and collect, ingest, monitor, search, and analyze Kubernetes logs for simplified, centralized log management and analysis.

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.