{"_id":"58250a3f3179ce0f007687bf","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"},"__v":0,"parentDoc":null,"project":"56ba46e2ce5d540d00e2d7a7","user":"5732062ad720220e008ea1d2","version":{"_id":"56ba46e2ce5d540d00e2d7aa","project":"56ba46e2ce5d540d00e2d7a7","__v":13,"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","59e5253fd460b50010237bed"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-11-11T00:01:03.378Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":1,"body":"## Overview\n\nLog data can be forwarded from a variety of Docker-based platforms to LogDNA. However, the setup instructions for each platform may be different. LogDNA currently supports logging from Docker, Docker Cloud, ECS, and Rancher.\n\nLogDNA Docker integrations rely on [LogSpout](https://github.com/gliderlabs/logspout), a log router for Docker containers. LogSpout utilizes syslog to send your Docker container log lines to your LogDNA account. \n\n##Docker\n\n1. Provision a syslog port for Docker. You can do so from the Docker section of the [add log source instructions](https://app.logdna.com/pages/add-host) modal available in the LogDNA web app.\n\n2. Run the following LogSpout command:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"sudo docker run --name=\\\"logdna\\\" --restart=always \\\\\\n-d -v=/var/run/docker.sock:/var/run/docker.sock \\\\\\n-e SYSLOG_STRUCTURED_DATA='logdna:::at:::48950 key=\\\"YOUR-INGESTION-KEY\\\" tag=\\\"docker\\\"' \\\\\\ngliderlabs/logspout syslog+tcp://syslog-a.logdna.com:6514\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\nPro tip: You can change the default docker host tag to any string you like, and even use multiple tags by separating them with a comma (,). \n\n##Docker Cloud\n\nAppend the following to your Docker Cloud stackfile:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"logdna:\\n  autoredeploy: true\\n  command: syslog+tls://syslog-a.logdna.com:6514\\n  deployment_strategy: every_node\\n  environment:\\n    - SYSLOG_HOSTNAME='{{index .Container.Config.Labels \\\"com.docker.compose.project\\\"}}'\\n    - SYSLOG_STRUCTURED_DATA='logdna@48950 key=\\\"YOUR-INGESTION-KEY\\\" tag=\\\"docker\\\"'\\n    - SYSLOG_TAG='{{.Container.Config.Hostname}}'\\n  image: 'gliderlabs/logspout:latest'\\n  restart: always\\n  volumes:\\n    - '/var/run/docker.sock:/var/run/docker.sock'\\n\",\n      \"language\": \"yaml\"\n    }\n  ]\n}\n[/block]\nPro tip: You can change the default docker host tag to any string you like, and even use multiple tags by separating them with a comma (,). \n\n##Elastic Container Service (ECS)\n\nAppend the following to your ECS cloud configuration:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"services:\\n  logspout:\\n    command: syslog+tls:syslog-a.logdna.com:6514\\n    environment:\\n      - SYSLOG_STRUCTURED_DATA='logdna@48950 key=\\\"YOUR-INGESTION-KEY\\\" tag=\\\"aws-ecs\\\"'\\n      - SYSLOG_TAG='{{ if .Container.Config.Labels }}{{index .Container.Config.Labels \\\"com.amazonaws.ecs.task-definition-family\\\"}}:{{index .Container.Config.Labels \\\"com.amazonaws.ecs.container-name\\\"}}{{ else }}{{.ContainerName}}{{ end }}'\\n    image: gliderlabs/logspout:latest\\n    restart: always\\n    volumes:\\n      - /var/run/docker.sock:/var/run/docker.sock\\n    deploy:\\n      mode: global\\n\",\n      \"language\": \"yaml\"\n    }\n  ]\n}\n[/block]\nPro tip: You can change the default docker host tag to any string you like, and even use multiple tags by separating them with a comma (,). \n\n## Rancher\n\n1. Create a LogDNA stack from the Rancher compose file below.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"version: '2'\\nservices:\\n  logdna:\\n    image: gliderlabs/logspout\\n    command: syslog+tls:syslog-a.logdna.com:6514\\n    environment:\\n      SYSLOG_STRUCTURED_DATA: logdna@48950 key=\\\"YOUR-INGESTION-KEY\\\" tag=\\\"rancher\\\"\\n    restart: always\\n    labels:\\n      io.rancher.container.hostname_override: container_name\\n      io.rancher.container.pull_image: always\\n      io.rancher.os.scope: system\\n    volumes:\\n    - /var/run/docker.sock:/tmp/docker.sock\",\n      \"language\": \"yaml\"\n    }\n  ]\n}\n[/block]\n2. Once created, add the following environment variables under the Command section of the Rancher web interface.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"SYSLOG_HOSTNAME = {{ index .Container.Config.Labels \\\"io.rancher.container.name\\\" }}\\nSYSLOG_TAG = {{ index .Container.Config.Labels \\\"io.rancher.stack_service.name\\\" }}\",\n      \"language\": \"yaml\"\n    }\n  ]\n}\n[/block]\nPro tip: You can change the default docker host tag to any string you like, and even use multiple tags by separating them with a comma (,).","excerpt":"","slug":"docker","type":"basic","title":"Docker Platforms"}
## Overview Log data can be forwarded from a variety of Docker-based platforms to LogDNA. However, the setup instructions for each platform may be different. LogDNA currently supports logging from Docker, Docker Cloud, ECS, and Rancher. LogDNA Docker integrations rely on [LogSpout](https://github.com/gliderlabs/logspout), a log router for Docker containers. LogSpout utilizes syslog to send your Docker container log lines to your LogDNA account. ##Docker 1. Provision a syslog port for Docker. You can do so from the Docker section of the [add log source instructions](https://app.logdna.com/pages/add-host) modal available in the LogDNA web app. 2. Run the following LogSpout command: [block:code] { "codes": [ { "code": "sudo docker run --name=\"logdna\" --restart=always \\\n-d -v=/var/run/docker.sock:/var/run/docker.sock \\\n-e SYSLOG_STRUCTURED_DATA='logdna@48950 key=\"YOUR-INGESTION-KEY\" tag=\"docker\"' \\\ngliderlabs/logspout syslog+tcp://syslog-a.logdna.com:6514", "language": "shell" } ] } [/block] Pro tip: You can change the default docker host tag to any string you like, and even use multiple tags by separating them with a comma (,). ##Docker Cloud Append the following to your Docker Cloud stackfile: [block:code] { "codes": [ { "code": "logdna:\n autoredeploy: true\n command: syslog+tls://syslog-a.logdna.com:6514\n deployment_strategy: every_node\n environment:\n - SYSLOG_HOSTNAME='{{index .Container.Config.Labels \"com.docker.compose.project\"}}'\n - SYSLOG_STRUCTURED_DATA='logdna@48950 key=\"YOUR-INGESTION-KEY\" tag=\"docker\"'\n - SYSLOG_TAG='{{.Container.Config.Hostname}}'\n image: 'gliderlabs/logspout:latest'\n restart: always\n volumes:\n - '/var/run/docker.sock:/var/run/docker.sock'\n", "language": "yaml" } ] } [/block] Pro tip: You can change the default docker host tag to any string you like, and even use multiple tags by separating them with a comma (,). ##Elastic Container Service (ECS) Append the following to your ECS cloud configuration: [block:code] { "codes": [ { "code": "services:\n logspout:\n command: syslog+tls:syslog-a.logdna.com:6514\n environment:\n - SYSLOG_STRUCTURED_DATA='logdna@48950 key=\"YOUR-INGESTION-KEY\" tag=\"aws-ecs\"'\n - SYSLOG_TAG='{{ if .Container.Config.Labels }}{{index .Container.Config.Labels \"com.amazonaws.ecs.task-definition-family\"}}:{{index .Container.Config.Labels \"com.amazonaws.ecs.container-name\"}}{{ else }}{{.ContainerName}}{{ end }}'\n image: gliderlabs/logspout:latest\n restart: always\n volumes:\n - /var/run/docker.sock:/var/run/docker.sock\n deploy:\n mode: global\n", "language": "yaml" } ] } [/block] Pro tip: You can change the default docker host tag to any string you like, and even use multiple tags by separating them with a comma (,). ## Rancher 1. Create a LogDNA stack from the Rancher compose file below. [block:code] { "codes": [ { "code": "version: '2'\nservices:\n logdna:\n image: gliderlabs/logspout\n command: syslog+tls:syslog-a.logdna.com:6514\n environment:\n SYSLOG_STRUCTURED_DATA: logdna@48950 key=\"YOUR-INGESTION-KEY\" tag=\"rancher\"\n restart: always\n labels:\n io.rancher.container.hostname_override: container_name\n io.rancher.container.pull_image: always\n io.rancher.os.scope: system\n volumes:\n - /var/run/docker.sock:/tmp/docker.sock", "language": "yaml" } ] } [/block] 2. Once created, add the following environment variables under the Command section of the Rancher web interface. [block:code] { "codes": [ { "code": "SYSLOG_HOSTNAME = {{ index .Container.Config.Labels \"io.rancher.container.name\" }}\nSYSLOG_TAG = {{ index .Container.Config.Labels \"io.rancher.stack_service.name\" }}", "language": "yaml" } ] } [/block] Pro tip: You can change the default docker host tag to any string you like, and even use multiple tags by separating them with a comma (,).