{"_id":"58a2596071f6b70f00749570","parentDoc":null,"__v":0,"user":"5732062ad720220e008ea1d2","version":{"_id":"56ba46e2ce5d540d00e2d7aa","project":"56ba46e2ce5d540d00e2d7a7","__v":12,"createdAt":"2016-02-09T20:06:58.727Z","releaseDate":"2016-02-09T20:06:58.727Z","categories":["56ba46e3ce5d540d00e2d7ab","5771a6b145c7080e0072927f","5771a72eb0ea6b0e006a5221","5772e5b20a6d610e00dea073","577c3006b20f211700593629","57ae587bca3e310e00538155","57ae593a7c93fa0e001e6b50","57b1f8263ff6c519005cf074","582601f155b1060f00ec4173","582a62857a96051b0070b011","58ebfae58d5a860f00851fb9","590a75a1ec0d5e190095ab38"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"project":"56ba46e2ce5d540d00e2d7a7","category":{"_id":"57ae593a7c93fa0e001e6b50","__v":0,"project":"56ba46e2ce5d540d00e2d7a7","version":"56ba46e2ce5d540d00e2d7aa","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2016-08-12T23:18:18.323Z","from_sync":false,"order":4,"slug":"platforms","title":"Platforms"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2017-02-14T01:12:00.604Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":6,"body":"## Setup\n\nShip logs from your Kubernetes v1.2+ cluster. To enable logging from Kubernetes, run the following commands. Be sure to replace YOUR-INGESTION-KEY-HERE with your [LogDNA Ingestion Key](https://app.logdna.com/manage/profile).\n```\nkubectl create secret generic logdna-agent-key --from-literal=logdna-agent-key=YOUR-INGESTION-KEY-HERE\nkubectl create -f https://raw.githubusercontent.com/logdna/logdna-agent/master/logdna-agent-ds.yaml\n```\n\nThis 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](https://app.logdna.com).\n\n## Usage\n\nWe extract pertinent Kubernetes metadata: pod name, container name, container id, namespace and display them inside the line [context menu](doc:context). You can search directly for logs matching these properties by clicking on them in the context menu or using our [field search syntax](doc:search#section-field-search):\n```\nnamespace:my-namespace\n```\n\nOnce 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.","excerpt":"","slug":"kubernetes","type":"basic","title":"Kubernetes"}
## Setup Ship logs from your Kubernetes v1.2+ cluster. To enable logging from Kubernetes, run the following commands. Be sure to replace YOUR-INGESTION-KEY-HERE with your [LogDNA Ingestion Key](https://app.logdna.com/manage/profile). ``` 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](https://app.logdna.com). ## Usage We extract pertinent Kubernetes metadata: pod name, container name, container id, namespace and display them inside the line [context menu](doc:context). You can search directly for logs matching these properties by clicking on them in the context menu or using our [field search syntax](doc:search#section-field-search): ``` 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.