{"id":67267,"date":"2019-11-08T12:27:45","date_gmt":"2019-11-08T12:27:45","guid":{"rendered":"https:\/\/drprem.com\/guide\/?p=67267"},"modified":"2020-10-07T10:37:53","modified_gmt":"2020-10-07T10:37:53","slug":"best-practices-for-docker-logging-infrastructure","status":"publish","type":"post","link":"https:\/\/drprem.com\/guide\/best-practices-for-docker-logging-infrastructure\/","title":{"rendered":"Best Practices for Docker Logging Infrastructure"},"content":{"rendered":"<div class=\"38520354a5201685ddf480eec688e1a7\" data-index=\"1\" style=\"float: none; margin:10px 0 10px 0; text-align:center;\">\n<script async src=\"https:\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js\"><\/script>\r\n<ins class=\"adsbygoogle\"\r\n     style=\"display:block; text-align:center;\"\r\n     data-ad-layout=\"in-article\"\r\n     data-ad-format=\"fluid\"\r\n     data-ad-client=\"ca-pub-9477973674766713\"\r\n     data-ad-slot=\"8885944693\"><\/ins>\r\n<script>\r\n     (adsbygoogle = window.adsbygoogle || []).push({});\r\n<\/script>\n<\/div>\n<p>Of all the container infrastructures, <em><strong>Docker<\/strong> <\/em>is by far the best-known and most popular. If you are one of the millions of Docker users, stay <a href=\"https:\/\/drprem.com\/your-new-company-doesnt-have-to-break-the-bank-to-climb-the-ladder\/\">up to date on best practices<\/a> by reviewing the points below. Container systems are taking over IT because of the incredible amount of convenience they offer. In a nutshell, containerized systems solve a singularly huge problem: they allow you to run software as you change environments. The process is scalable, simple and reliable.<\/p>\n<p>How do containers achieve this technological miracle? They offer a comprehensive runtime environment within a single package. That dense package contains not only an app but binaries, libraries, configuration files and dependencies.<!--more--><\/p>\n<h2>Logging Infrastructure<\/h2>\n<p><img fetchpriority=\"high\" decoding=\"async\" class=\"alignnone size-full wp-image-67285\" src=\"https:\/\/drprem.com\/guide\/wp-content\/uploads\/sites\/54\/2019\/11\/Docker-Logging-Infrastructure-2.jpg\" alt=\"Docker Logging Infrastructure\" width=\"800\" height=\"494\" srcset=\"https:\/\/drprem.com\/guide\/wp-content\/uploads\/sites\/54\/2019\/11\/Docker-Logging-Infrastructure-2.jpg 800w, https:\/\/drprem.com\/guide\/wp-content\/uploads\/sites\/54\/2019\/11\/Docker-Logging-Infrastructure-2-300x185.jpg 300w, https:\/\/drprem.com\/guide\/wp-content\/uploads\/sites\/54\/2019\/11\/Docker-Logging-Infrastructure-2-768x474.jpg 768w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/p>\n<p>Whenever we develop applications, logging is the essential, core component of the chore because of how useful it is when problems show up. Keep in mind, however, that a <a href=\"https:\/\/www.papertrail.com\/solution\/docker-syslog\/\" target=\"_blank\" rel=\"noopener\">Docker log server<\/a> uses containerized applications exclusively. That means much of what you know about traditional logging must be put aside for the time being.<\/p>\n<h2>The Docker Log Server<\/h2>\n<p>As we work with the Docker log server and the rest of the components of any containerized system, it\u2019s important to remember Docker-specific best practices. Here are the key points of those practices based on particular activities within the Docker log server:<\/p>\n<h3>Using Data Volumes<\/h3>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-67286\" src=\"https:\/\/drprem.com\/guide\/wp-content\/uploads\/sites\/54\/2019\/11\/Using-Data-Volumes.jpg\" alt=\"Using Data Volumes\" width=\"800\" height=\"483\" srcset=\"https:\/\/drprem.com\/guide\/wp-content\/uploads\/sites\/54\/2019\/11\/Using-Data-Volumes.jpg 800w, https:\/\/drprem.com\/guide\/wp-content\/uploads\/sites\/54\/2019\/11\/Using-Data-Volumes-300x181.jpg 300w, https:\/\/drprem.com\/guide\/wp-content\/uploads\/sites\/54\/2019\/11\/Using-Data-Volumes-768x464.jpg 768w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/p><div class=\"38520354a5201685ddf480eec688e1a7\" data-index=\"2\" style=\"float: none; margin:10px 0 10px 0; text-align:center;\">\n<script async src=\"https:\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js\"><\/script>\r\n<ins class=\"adsbygoogle\"\r\n     style=\"display:block; text-align:center;\"\r\n     data-ad-layout=\"in-article\"\r\n     data-ad-format=\"fluid\"\r\n     data-ad-client=\"ca-pub-9477973674766713\"\r\n     data-ad-slot=\"8885944693\"><\/ins>\r\n<script>\r\n     (adsbygoogle = window.adsbygoogle || []).push({});\r\n<\/script>\n<\/div>\n\n<ul>\n<li>When a container shuts down, all its files are lost forever. That\u2019s because containers are designed to be transitory entities. So, what happens when containers receive log events? In Docker and other containerized systems, they forward them to a central logging server or else place them into a special directory, within a container, that is specifically designed to hold data.<\/li>\n<li>That directory is commonly known as a \u201cdata volume,\u201d and there are quite a few advantages to using them. For starters, data volumes are precisely and directly linked to specific host-based directories. That means the data won\u2019t be lost and, in fact, can even be shared. So, if a container faces a problem and shuts down as a result, there\u2019s no need to worry about losing all the data.<\/li>\n<\/ul>\n<h3>The Logging Driver in Docker<\/h3>\n<ul>\n<li>Another strategy for logging Docker events is through logging drivers. You can easily use the drivers to handle log events by simply forwarding them to the host\u2019s syslog. Even though the Docker driver has built-in advantages when it comes to speed and performance, there are a few disadvantages.<\/li>\n<li>First, you\u2019ll only be able to forward, not parse. Second, all those log commands you&#8217;ve grown accustomed to will only be operative with JSON files. Finally, if the TCP server is ever out of reach, the containers will be terminated.<\/li>\n<\/ul>\n<h3>Dedicated Logging Container<\/h3>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-67284\" src=\"https:\/\/drprem.com\/guide\/wp-content\/uploads\/sites\/54\/2019\/11\/Docker-Logging-Infrastructure-1.jpg\" alt=\"Docker Logging Infrastructure\" width=\"800\" height=\"645\" srcset=\"https:\/\/drprem.com\/guide\/wp-content\/uploads\/sites\/54\/2019\/11\/Docker-Logging-Infrastructure-1.jpg 800w, https:\/\/drprem.com\/guide\/wp-content\/uploads\/sites\/54\/2019\/11\/Docker-Logging-Infrastructure-1-300x242.jpg 300w, https:\/\/drprem.com\/guide\/wp-content\/uploads\/sites\/54\/2019\/11\/Docker-Logging-Infrastructure-1-768x619.jpg 768w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/p>\n<ul>\n<li>If you want to do all your <a href=\"https:\/\/www.esecurityplanet.com\/products\/solarwinds-log-event-manager-siem.html\" target=\"_blank\" rel=\"noopener\">log event management<\/a> solely within Docker, the dedicated logging container is the way to go. The beauty of this container is that it\u2019s fully able to collect, aggregate, store and forward log events you gather from other containers. If you want, you can even forward them to a third-party. That means you\u2019re no longer dependent on a host.<\/li>\n<\/ul>\n<p>Article Submitted By Community Writer<\/p>\n<div class=\"38520354a5201685ddf480eec688e1a7\" data-index=\"3\" style=\"float: none; margin:10px 0 10px 0; text-align:center;\">\n          <p><a id=\"link-15\" href=\"\" target=\"_blank\" rel=\"noopener noreferrer\">\r\n            <img decoding=\"async\" style=\"width:100%;height:auto;\" id=\"img-15\" src=\"\"><\/a><\/p>\r\n            <script>\r\n            var xmlhttp = new XMLHttpRequest();\r\n            xmlhttp.onreadystatechange = function() {\r\n              if (this.readyState == 4 && this.status == 200) {\r\n                var myObj = JSON.parse(this.responseText);\r\n                document.getElementById(\"link-\"+myObj.id).setAttribute('href',myObj.url);\r\n                document.getElementById(\"img-\"+myObj.id).setAttribute('src','https:\/\/fetch.drprem.com\/\/uploads\/'+myObj.image);\r\n              }\r\n            };\r\n            xmlhttp.open(\"GET\", \"https:\/\/fetch.drprem.com\/\/api\/Ads\/15\", true);\r\n            xmlhttp.send();\r\n            <\/script>\r\n        \r\n        <style>\r\n        *{box-sizing:border-box}.top-container{display: grid;grid-template-columns: auto auto auto;}.column{float:left;width:100%;padding: 0 7.5px 15px 7.5px;}.row{margin:0 -5px}.row:after{content:\"\";display:table;clear:both}@media screen and (max-width: 600px){.top-container{display: block;grid-template-columns: unset;}.column{width:100%;display:block;margin-bottom:20px}}.card{text-align:center;}.card_image img{width:100%}.card_body{padding:15px}.card_title{font-size: 14px;line-height: 19px;text-decoration: none;text-align:left;color: #333;}.card-heading{text-align: left;margin-bottom: 25px !important;}\r\n        <\/style>\r\n        <div class=\"row todays-top\">\r\n            <h3 class=\"card-heading\"> Recent Articles: <\/h3><div class=\"top-container\" id=\"todays-top\">\r\n        <\/div>\r\n        <\/div>\r\n        <script>\r\n            var xmlhttp = new XMLHttpRequest();\r\n            xmlhttp.onreadystatechange = function() {\r\n            if (this.readyState == 4 && this.status == 200) {\r\n            var myObj = JSON.parse(this.responseText); \r\n            myObj.forEach(function(item) {\r\n            document.getElementById('todays-top').innerHTML += '<div class=\"column\"><div class=\"card\"><div class=\"card_image\"><a href=\"'+item.url+'\"><img decoding=\"async\" src=\"'+item.image+'\"><\/a><\/div><div class=\"card_body\"><a href=\"'+item.url+'\"><h3 class=\"card_title\">'+item.title+'<\/h3><\/a><a href=\"'+item.url+'\">Read more<\/a><\/div><\/div><\/div>';\r\n            });\r\n            }\r\n            };\r\n            xmlhttp.open(\"GET\", \"https:\/\/fetch.drprem.com\/api\/Drprem_blogs\", true);\r\n            xmlhttp.send();\r\n            <\/script>\r\n        \r\n        \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<style>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.videoWrapper{position:relative;padding-bottom:56.25%;height:0}.videoWrapper iframe{position:absolute;top:0;left:0;width:100%;height:100%}\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/style>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<div class=\"videoWrapper\" id=\"video_7\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<script>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tvar xmlhttp = new XMLHttpRequest();\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t            xmlhttp.onreadystatechange = function() {\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t            if (this.readyState == 4 && this.status == 200) {\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t                var myObj = JSON.parse(this.responseText);\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t                document.getElementById(\"video_\"+myObj.id).innerHTML = myObj.embed_video_code;\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t            }\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t            };\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t            xmlhttp.open(\"GET\", \"https:\/\/fetch.drprem.com\/api\/Videos\/7\", true);\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t            xmlhttp.send();\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/script>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\n<\/div>\n\n<div style=\"font-size: 0px; height: 0px; line-height: 0px; margin: 0; padding: 0; clear: both;\"><\/div>","protected":false},"excerpt":{"rendered":"<p>Of all the container infrastructures, Docker is by far the best-known and most popular. If you are one of the millions of Docker users, stay up to date on best practices by reviewing the points below. Container systems are taking [&hellip;]<\/p>\n","protected":false},"author":107,"featured_media":67284,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[4722],"tags":[4032,4035,4036,4042,4033,799,4037,4043,4034,1955],"class_list":["post-67267","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-life-improving","tag-best-practices","tag-data-volumes","tag-dedicated-logging-container","tag-docker-log-server","tag-docker-logging-infrastructure","tag-featured","tag-logging-driver-in-docker","tag-technological-miracle","tag-the-docker-log-server","tag-top"],"_links":{"self":[{"href":"https:\/\/drprem.com\/guide\/wp-json\/wp\/v2\/posts\/67267","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/drprem.com\/guide\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/drprem.com\/guide\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/drprem.com\/guide\/wp-json\/wp\/v2\/users\/107"}],"replies":[{"embeddable":true,"href":"https:\/\/drprem.com\/guide\/wp-json\/wp\/v2\/comments?post=67267"}],"version-history":[{"count":0,"href":"https:\/\/drprem.com\/guide\/wp-json\/wp\/v2\/posts\/67267\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/drprem.com\/guide\/wp-json\/wp\/v2\/media\/67284"}],"wp:attachment":[{"href":"https:\/\/drprem.com\/guide\/wp-json\/wp\/v2\/media?parent=67267"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/drprem.com\/guide\/wp-json\/wp\/v2\/categories?post=67267"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/drprem.com\/guide\/wp-json\/wp\/v2\/tags?post=67267"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}