{"id":193759,"date":"2020-06-19T11:28:38","date_gmt":"2020-06-19T03:28:38","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=193759"},"modified":"2020-06-15T09:29:40","modified_gmt":"2020-06-15T01:29:40","slug":"log-engine-description","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/log-engine-description.html","title":{"rendered":"docker\u65e5\u5fd7\u5f15\u64ce"},"content":{"rendered":"
\u5bfc\u8bfb<\/td>\n | docker\u539f\u751f\u652f\u6301\u4f17\u591a\u7684\u65e5\u5fd7\u5f15\u64ce\uff0c\u9002\u7528\u4e8e\u5404\u79cd\u4e0d\u540c\u7684\u5e94\u7528\u573a\u666f\uff0c\u672c\u7bc7\u6587\u6863\u5bf9\u5176\u4f5c\u4e00\u4e2a\u7b80\u5355\u7684\u8bf4\u660e\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n Docker\u65e5\u5fd7\u5f15\u64ce\u8bf4\u660e<\/strong><\/span><\/div>\n docker\u652f\u6301\u7684\u65e5\u5fd7\u5f15\u64ce\u5982\u4e0b\uff1a<\/p>\n none\uff1a\u5173\u95eddocker\u7684\u56de\u663e\u65e5\u5fd7, docker logs \u770b\u4e0d\u5230\u4efb\u4f55\u8f93\u51fa\u3002\u4f7f\u7528\u8fd9\u79cd\u65b9\u5f0f\u4e5f\u5c31\u610f\u5473\u7740\u65e0\u6cd5\u67e5\u770b\u4efb\u4f55\u5bb9\u5668\u8f93\u51fa\u7684\u65e5\u5fd7\u3002<\/p>\n json-file\uff1a\u628a\u6bcf\u4e2a\u5bb9\u5668\u7684\u56de\u663e\u65e5\u5fd7\u6253\u5230\u6bcf\u4e2a\u5bb9\u5668\u7684\u5185\u90e8, \u5f62\u5f0f\u4e3ajson \u6587\u4ef6\u3002\u5728\u5b9e\u9645\u4f7f\u7528\u4e2d, \u6709\u4e9b\u5bb9\u5668\u5728\u542f\u52a8\u540e\u6709\u5927\u91cf\u7684\u56de\u663e\u65e5\u5fd7, \u5c24\u5176\u5728\u7a0b\u5e8f\u5185\u90e8\u62a5\u9519\u65f6\u6253\u51fa\u7684\u65e5\u5fd7\u4fe1\u606f\u5c24\u5176\u5de8\u5927, \u5f88\u53ef\u80fd\u4f1a\u56e0\u4e3a\u67d0\u51e0\u4e2a\u5bb9\u5668\u7684json \u65e5\u5fd7\u8fc7\u5927\u800c\u6491\u7206\u6574\u4e2a\u5bbf\u4e3b\u673a\u7684\u78c1\u76d8\u3002<\/p>\n syslog\uff1a\u628a\u6240\u6709\u5bb9\u5668\u7684\u56de\u663e\u65e5\u5fd7\u6253\u5230\u7cfb\u7edf\u7684syslog\u4e2d\u3002<\/p>\n \u76ee\u524dharbor\u79c1\u6709\u955c\u50cf\u4ed3\u5e93\u4f7f\u7528docker-compose\u65b9\u5f0f\u542f\u52a8\u7684\u8bdd\uff0c\u5c31\u9ed8\u8ba4\u4f7f\u7528\u7684\u8fd9\u79cd\u65b9\u5f0f\u3002\u5c06\u6240\u6709\u5bb9\u5668\u7684\u65e5\u5fd7\u90fd\u96c6\u4e2d\u6536\u96c6\u5230\u4e00\u4e2aharbor-log\u7684\u5bb9\u5668\u4e2d\uff0c\u5728\u6267\u884cdocker logs\u7684\u65f6\u5019\u4f1a\u63d0\u793a\"logs\" command is supported only for \"json-file\" and \"journald\" loggin drivers (got: syslog)\u3002<\/p>\n journald\uff1a\u628a\u6240\u6709\u5bb9\u5668\u7684\u56de\u663e\u65e5\u5fd7\u6253\u5230\u7cfb\u7edf\u7684journald\u670d\u52a1\u4e2d\uff0c\u8fd9\u662f\u63a8\u8350\u7684\u65b9\u5f0f\u3002<\/p>\n fluentd\uff1a\u628a\u6240\u6709\u5bb9\u5668\u7684\u56de\u663e\u65e5\u5fd7\u6253\u5230fluentd\u670d\u52a1\u4e2d\u3002<\/p>\n gelf \u628a\u6240\u6709\u5bb9\u5668\u7684\u56de\u663e\u65e5\u5fd7\u6253\u5230\u652f\u6301 GELF(Graylog Extended Log Format) \u683c\u5f0f\u7684\u670d\u52a1\u4e2d, \u6bd4\u5982Graylog\u6216Logstash\u3002<\/p>\n \u4fee\u6539docker\u65e5\u5fd7\u5f15\u64ce<\/strong><\/span><\/div>\n \u4fee\u6539docker\u914d\u7f6e\u6587\u4ef6\/etc\/docker\/daemon.json\u5982\u4e0b\uff1a<\/p>\n \r\n{\r\n \"log-driver\": \"journald\"\r\n}\r\n<\/pre>\n |