{"id":320767,"date":"2021-04-02T15:03:02","date_gmt":"2021-04-02T15:03:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=320767"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=320767","title":{"rendered":"\u041e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u044f \u0441\u0431\u043e\u0440\u0430 \u0438 \u043f\u0430\u0440\u0441\u0438\u043d\u0433\u0430 \u043b\u043e\u0433\u043e\u0432 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 Filebeat"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\">\n<p>\u0412 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445 \u043a \u043c\u043e\u0435\u043c\u0443 <a href=\"https:\/\/habr.com\/ru\/post\/548998\/\">\u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u0443<\/a>, \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0449\u0435\u043c\u0443 \u043e \u043f\u0430\u0440\u0441\u0438\u043d\u0433\u0435 \u043b\u043e\u0433\u043e\u0432 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Fluent-bit, \u0431\u044b\u043b\u043e \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043e \u0434\u0432\u0435 \u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u044b: <a href=\"https:\/\/www.elastic.co\/guide\/en\/beats\/filebeat\/current\/filebeat-overview.html\" rel=\"nofollow noopener noreferrer\">Filebeat<\/a> \u0438 <a href=\"https:\/\/vector.dev\" rel=\"nofollow noopener noreferrer\">Vector<\/a>. \u042d\u0442\u043e\u0442 \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043a\u0430\u043a \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0431\u043e\u0440 \u0438 \u043f\u0430\u0440\u0441\u0438\u043d\u0433 \u043b\u043e\u0433-\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 Filebeat.<\/p>\n<p>  <\/p>\n<p><strong>\u0426\u0435\u043b\u044c \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u0430:<\/strong> \u041e\u0440\u0433\u0430\u043d\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0431\u043e\u0440 \u0438 \u043f\u0430\u0440\u0441\u0438\u043d\u0433 \u043b\u043e\u0433-\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Filebeat.<\/p>\n<p>  <\/p>\n<p><strong>\u0414\u0438\u0441\u043a\u043b\u0435\u0439\u043c\u0435\u0440:<\/strong> \u0422\u0443\u0442\u043e\u0440\u0438\u0430\u043b \u043d\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0433\u043e\u0442\u043e\u0432\u044b\u0445 \u0434\u043b\u044f \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u0435\u043d\u0430 \u0440\u0435\u0448\u0435\u043d\u0438\u0439, \u043e\u043d \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u0441 \u0446\u0435\u043b\u044c\u044e \u043f\u043e\u043c\u043e\u0447\u044c \u0442\u0435\u043c \u043a\u0442\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442 \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u044c\u0441\u044f \u0441 filebeat \u0438 \u0434\u043b\u044f \u0437\u0430\u043a\u0440\u0435\u043f\u043b\u0435\u043d\u0438\u044f \u0438\u0437\u0443\u0447\u0435\u043d\u043d\u043e\u0433\u043e \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0430 \u0430\u0432\u0442\u043e\u0440\u043e\u043c. \u0422\u0430\u043a \u0436\u0435 \u0432 \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u0435 \u043d\u0435 \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0434\u043e\u0441\u0442\u0430\u0432\u0449\u0438\u043a\u043e\u0432 \u043b\u043e\u0433\u043e\u0432. \u0421\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 <a href=\"https:\/\/sematext.com\/blog\/logstash-alternatives\/\" rel=\"nofollow noopener noreferrer\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<p>  <\/p>\n<p>\u041a\u043e\u043c\u0443 \u0434\u0430\u043d\u043d\u0430\u044f \u0442\u0435\u043c\u0430 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0430, \u043f\u0440\u043e\u0448\u0443 \u043f\u043e\u0434 \u043a\u0430\u0442:)<a name=\"habracut\"><\/a><\/p>\n<p>  <\/p>\n<p>\u0422\u0435\u0441\u0442\u043e\u0432\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u043c \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <a href=\"https:\/\/docs.docker.com\/compose\/\" rel=\"nofollow noopener noreferrer\">docker-compose<\/a>.<\/p>\n<p>  <\/p>\n<h2 id=\"obschaya-informaciya\">\u041e\u0431\u0449\u0430\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f<\/h2>\n<p>  <\/p>\n<p><a href=\"https:\/\/www.elastic.co\/guide\/en\/beats\/filebeat\/current\/filebeat-overview.html\" rel=\"nofollow noopener noreferrer\">Filebeat<\/a> \u2014 \u044d\u0442\u043e \u043b\u0435\u0433\u043a\u043e\u0432\u0435\u0441\u043d\u044b\u0439 \u0434\u043e\u0441\u0442\u0430\u0432\u0449\u0438\u043a \u043b\u043e\u0433-\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439. \u041f\u0440\u0438\u043d\u0446\u0438\u043f \u0435\u0433\u043e \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0432 \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0435 \u0438 \u0441\u0431\u043e\u0440\u0435 \u043b\u043e\u0433-\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u0438\u0437 \u043b\u043e\u0433-\u0444\u0430\u0439\u043b\u043e\u0432 \u0438 \u043f\u0435\u0440\u0435\u0441\u044b\u043b\u043a\u0438 \u0438\u0445 \u0432 <a href=\"https:\/\/www.elastic.co\/products\/elasticsearch\" rel=\"nofollow noopener noreferrer\">elasticsearch<\/a> \u0438\u043b\u0438 <a href=\"https:\/\/www.elastic.co\/products\/logstash\" rel=\"nofollow noopener noreferrer\">logstash<\/a> \u0434\u043b\u044f \u0438\u043d\u0434\u0435\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f.<\/p>\n<p>  <\/p>\n<p>Filebeat \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432:<\/p>\n<p>  <\/p>\n<ul>\n<li>\u0441\u0431\u043e\u0440\u0449\u0438\u043a\u0438 (<a href=\"https:\/\/www.elastic.co\/guide\/en\/beats\/filebeat\/current\/how-filebeat-works.html#harvester\" rel=\"nofollow noopener noreferrer\">harvesters<\/a>) \u2014 \u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0442 \u0437\u0430 \u0447\u0442\u0435\u043d\u0438\u0435 \u043b\u043e\u0433-\u0444\u0430\u0439\u043b\u043e\u0432 \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0443 \u043b\u043e\u0433-\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u0432 \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u0439 \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441, \u043d\u0430 \u043a\u0430\u0436\u0434\u044b\u0439 \u043b\u043e\u0433-\u0444\u0430\u0439\u043b \u0437\u0430\u0434\u0430\u0435\u0442\u0441\u044f \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u0441\u0431\u043e\u0440\u0449\u0438\u043a;<\/li>\n<li>\u0432\u0445\u043e\u0434\u043d\u044b\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u044b (<a href=\"https:\/\/www.elastic.co\/guide\/en\/beats\/filebeat\/current\/how-filebeat-works.html#input\" rel=\"nofollow noopener noreferrer\">inputs<\/a>) \u2014 \u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0442 \u0437\u0430 \u043f\u043e\u0438\u0441\u043a \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u0432 \u043b\u043e\u0433-\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u0431\u043e\u0440\u0449\u0438\u043a\u0430\u043c\u0438.<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435 \u0440\u0430\u0431\u043e\u0442\u044b \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0432 <a href=\"https:\/\/www.elastic.co\/guide\/en\/beats\/filebeat\/current\/how-filebeat-works.html\" rel=\"nofollow noopener noreferrer\">\u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u043c \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0435<\/a>.<\/p>\n<p>  <\/p>\n<h2 id=\"organizaciya-sbora-log-soobscheniy\">\u041e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u044f \u0441\u0431\u043e\u0440\u0430 \u043b\u043e\u0433-\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439<\/h2>\n<p>  <\/p>\n<p>Filebeat \u0438\u043c\u0435\u0435\u0442 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e <a href=\"https:\/\/www.elastic.co\/guide\/en\/beats\/filebeat\/current\/configuration-filebeat-options.html\" rel=\"nofollow noopener noreferrer\">\u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u0432<\/a> \u0434\u043b\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u0432 \u043b\u043e\u0433-\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439. \u0412 \u0440\u0430\u043c\u043a\u0430\u0445 \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u0430 \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u0434\u0432\u0438\u0433\u0430\u0442\u044c\u0441\u044f \u043e\u0442 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0441\u0431\u043e\u0440\u0430 \u0432\u0440\u0443\u0447\u043d\u0443\u044e \u0434\u043e \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043f\u043e\u0438\u0441\u043a\u0430 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u0432 \u043b\u043e\u0433-\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u0432 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430\u0445. \u041f\u043e \u043c\u043e\u0435\u043c\u0443 \u043c\u043d\u0435\u043d\u0438\u044e \u0434\u0430\u043d\u043d\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u0433\u043b\u0443\u0431\u0436\u0435 \u043f\u043e\u043d\u044f\u0442\u044c filebeat, \u043a \u0442\u043e\u043c\u0443 \u0436\u0435 \u044f \u0441\u0430\u043c \u0434\u0432\u0438\u0433\u0430\u043b\u0441\u044f \u0442\u0435\u043c \u0436\u0435 \u043f\u0443\u0442\u0435\u043c.<\/p>\n<p>  <\/p>\n<p>\u041d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c \u0441\u0435\u0440\u0432\u0438\u0441, \u043b\u043e\u0433-\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0431\u0443\u0434\u0435\u043c \u043f\u0435\u0440\u0435\u0441\u044b\u043b\u0430\u0442\u044c \u043d\u0430 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435.<br \/>  \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0442\u0430\u043a\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0432\u043e\u0437\u044c\u043c\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <a href=\"https:\/\/fastapi.tiangolo.com\" rel=\"nofollow noopener noreferrer\">FastAPI<\/a>, \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u0446\u0435\u043b\u044c\u044e \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u043b\u043e\u0433-\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439.<\/p>\n<p>  <\/p>\n<h3 id=\"sbor-log-soobscheniy-s-pomoschyu-volume\">\u0421\u0431\u043e\u0440 \u043b\u043e\u0433-\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e volume<\/h3>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043a\u043b\u043e\u043d\u0438\u0440\u0443\u0435\u043c <a href=\"https:\/\/github.com\/voro6yov\/filebeat-template.git\" rel=\"nofollow noopener noreferrer\">\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439<\/a>. \u0412 \u043d\u0435\u043c \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b Filebeat \u0438 docker-compose.yml.<br \/>  \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0441\u0431\u043e\u0440\u0430 \u043b\u043e\u0433-\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e volume \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0448\u0430\u0433\u043e\u0432:<\/p>\n<p>  <\/p>\n<ol>\n<li>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043b\u043e\u0433\u0433\u0435\u0440\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0430 \u0437\u0430\u043f\u0438\u0441\u044c \u043b\u043e\u0433-\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u0432 \u0444\u0430\u0439\u043b:<br \/>  <em><code>app\/api\/main.py<\/code><\/em><br \/> \n<pre><code class=\"plaintext\">logger.add(     &quot;.\/logs\/file.log&quot;,     format=&quot;app-log - {level} - {message}&quot;,     rotation=&quot;500 MB&quot; )<\/code><\/pre>\n<\/li>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 <em>volume<\/em> \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u043b\u043e\u0433-\u0444\u0430\u0439\u043b\u043e\u0432 \u0432\u043d\u0435 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043e\u0432:<br \/>  <em><code>docker-compose.yml<\/code><\/em><\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">version: &quot;3.8&quot;  services:   app:     ...     volumes:       # \u0441\u043e\u0437\u0434\u0430\u0435\u043c volume, \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u043b\u043e\u0433-\u0444\u0430\u0439\u043b\u043e\u0432 \u0432\u043d\u0435 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430       - app-logs:\/logs    log-shipper:     ...     volumes:       # \u0437\u0430\u043c\u0435\u043d\u044f\u0435\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u0432 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0435       - .\/filebeat.docker.yml:\/usr\/share\/filebeat\/filebeat.yml:ro       # \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c volume \u0441 \u043b\u043e\u0433-\u0444\u0430\u0439\u043b\u0430\u043c\u0438 \u0432 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440       - app-logs:\/var\/app\/log  volumes:   app-logs:<\/code><\/pre>\n<p>  <\/li>\n<li>\n<p>\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0432\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0438 \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u0432 filebeat:<br \/>  <em><code>filebeat.docker.yml<\/code><\/em><\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">filebeat.inputs: - type: log   # \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u043f\u0443\u0442\u044c \u043a \u043b\u043e\u0433-\u0444\u0430\u0439\u043b\u0430\u043c   paths:     - \/var\/app\/log\/*.log  # \u041f\u043e\u043a\u0430 \u0431\u0443\u0434\u0435\u043c \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u043b\u043e\u0433-\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c output.console:   pretty: true<\/code><\/pre>\n<p>  <\/p>\n<p>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u043b\u043e\u0433-\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0438\u0445 \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u0444\u043e\u0440\u043c\u0430\u0442\u0435:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">{ &quot;@timestamp&quot;: &quot;2021-04-01T04:02:28.138Z&quot;, &quot;@metadata&quot;: { &quot;beat&quot;: &quot;filebeat&quot;, &quot;type&quot;: &quot;_doc&quot;, &quot;version&quot;: &quot;7.12.0&quot; }, &quot;ecs&quot;: { &quot;version&quot;: &quot;1.8.0&quot; }, &quot;host&quot;: { &quot;name&quot;: &quot;aa9718a27eb9&quot; }, &quot;message&quot;: &quot;app-log - ERROR - [Item not found] - 1&quot;, &quot;log&quot;: { &quot;offset&quot;: 377, &quot;file&quot;: {   &quot;path&quot;: &quot;\/var\/app\/log\/file.log&quot; } }, &quot;input&quot;: { &quot;type&quot;: &quot;log&quot; }, &quot;agent&quot;: { &quot;version&quot;: &quot;7.12.0&quot;, &quot;hostname&quot;: &quot;aa9718a27eb9&quot;, &quot;ephemeral_id&quot;: &quot;df245ed5-bd04-4eca-8b89-bd0c61169283&quot;, &quot;id&quot;: &quot;35333344-c3cc-44bf-a4d6-3a7315c328eb&quot;, &quot;name&quot;: &quot;aa9718a27eb9&quot;, &quot;type&quot;: &quot;filebeat&quot; } }<\/code><\/pre>\n<p>  <\/li>\n<\/ol>\n<p>  <\/p>\n<h3 id=\"sbor-log-soobscheniy-s-pomoschyu-vhodnogo-interfeysa-container\">\u0421\u0431\u043e\u0440 \u043b\u043e\u0433-\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0432\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 <em>container<\/em><\/h3>\n<p>  <\/p>\n<p><a href=\"https:\/\/www.elastic.co\/guide\/en\/beats\/filebeat\/current\/filebeat-input-container.html#filebeat-input-container\" rel=\"nofollow noopener noreferrer\">\u0421ontainer<\/a> \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0442\u044c \u0441\u0431\u043e\u0440 \u043b\u043e\u0433-\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u0441 \u043b\u043e\u0433-\u0444\u0430\u0439\u043b\u043e\u0432 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043e\u0432.<br \/>  \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0441\u0431\u043e\u0440\u0430 \u043b\u043e\u0433-\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0432\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 <em>container<\/em> \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0448\u0430\u0433\u043e\u0432:<\/p>\n<p>  <\/p>\n<ol>\n<li>\u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a \u0432\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 <em>log<\/em>, \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043d\u0430 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c \u044d\u0442\u0430\u043f\u0435, \u0438\u0437 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430.<\/li>\n<li>\n<p>\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0432\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 <em>container<\/em> \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u043c \u0444\u0430\u0439\u043b\u0435:<br \/>  <em><code>filebeat.docker.yml<\/code><\/em><\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">filebeat.inputs: - type: container   # \u043f\u0443\u0442\u044c \u043a \u043b\u043e\u0433-\u0444\u0430\u0439\u043b\u0430\u043c \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043e\u0432   paths:     - '\/var\/lib\/docker\/containers\/*\/*.log'  # \u041f\u043e\u043a\u0430 \u0431\u0443\u0434\u0435\u043c \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u043b\u043e\u0433-\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c output.console:   pretty: true<\/code><\/pre>\n<p>  <\/li>\n<li>\u041e\u0442\u043a\u043b\u044e\u0447\u0430\u0435\u043c volume <em>app-logs<\/em> \u0438\u0437 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 <strong>app<\/strong> \u0438 <strong>log-shipper<\/strong> \u0438 \u0443\u0434\u0430\u043b\u044f\u0435\u043c \u0435\u0433\u043e, \u043e\u043d \u043d\u0430\u043c \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f.<\/li>\n<li>\n<p>\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u043a \u0441\u0435\u0440\u0432\u0438\u0441\u0443 <strong>log-shipper<\/strong> \u043b\u043e\u0433-\u0444\u0430\u0439\u043b\u044b \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043e\u0432 \u0438 \u0441\u043e\u043a\u0435\u0442 \u0434\u043e\u043a\u0435\u0440\u0430:<br \/>  <em><code>docker-compose.yml<\/code><\/em><\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">version: &quot;3.8&quot;  services:   app:     ...    log-shipper:     ...     volumes:       # \u0437\u0430\u043c\u0435\u043d\u044f\u0435\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u0432 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0435       - .\/filebeat.docker.yml:\/usr\/share\/filebeat\/filebeat.yml:ro       - \/var\/lib\/docker\/containers:\/var\/lib\/docker\/containers:ro       - \/var\/run\/docker.sock:\/var\/run\/docker.sock:ro<\/code><\/pre>\n<p>  <\/li>\n<li>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043b\u043e\u0433\u0433\u0435\u0440\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0430 \u0437\u0430\u043f\u0438\u0441\u044c \u043b\u043e\u0433-\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u0432 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u0432\u044b\u0432\u043e\u0434:<br \/>  <em><code>app\/api\/main.py<\/code><\/em><br \/> \n<pre><code class=\"plaintext\">logger.add(     sys.stdout,     format=&quot;app-log - {level} - {message}&quot;, )<\/code><\/pre>\n<\/li>\n<\/ol>\n<p>  <\/p>\n<p>\u0412\u0445\u043e\u0434\u043d\u043e\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 <em>container<\/em>, \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c \u043b\u043e\u0433-\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0441\u043e \u0432\u0441\u0435\u0445 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043e\u0432, \u043e\u0434\u043d\u0430\u043a\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c \u043b\u043e\u0433-\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0441 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043e\u0432.<br \/>  \u042d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u043c \u043d\u0438\u0436\u0435 \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c.<\/p>\n<p>  <\/p>\n<h3 id=\"sbor-log-soobscheniy-s-pomoschyu-avtoobnaruzheniya\">\u0421\u0431\u043e\u0440 \u043b\u043e\u0433-\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0430\u0432\u0442\u043e\u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f<\/h3>\n<p>  <\/p>\n<p>\u041f\u0440\u0438 \u0441\u0431\u043e\u0440\u0435 \u043b\u043e\u0433-\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043e\u0432, \u043c\u043e\u0433\u0443\u0442 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0443\u0442\u044c \u0442\u0440\u0443\u0434\u043d\u043e\u0441\u0442\u0438, \u0442\u0430\u043a \u043a\u0430\u043a \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u044b \u043c\u043e\u0433\u0443\u0442 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c\u0441\u044f, \u0443\u0434\u0430\u043b\u044f\u0442\u044c\u0441\u044f \u0438 \u0442.\u0434. \u0412 \u0441\u0432\u044f\u0437\u0438 \u0441 \u044d\u0442\u0438\u043c \u0432 filebeat \u0435\u0441\u0442\u044c \u0430\u0432\u0442\u043e\u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u0435 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043e\u0432, \u0441 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c\u044e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a \u0441\u0431\u043e\u0440\u0430 \u043b\u043e\u0433-\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u043d\u043e\u0433\u043e \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430. \u041c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u0430\u0432\u0442\u043e\u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u0434\u0432\u0443\u0445 \u0447\u0430\u0441\u0442\u0435\u0439:<\/p>\n<p>  <\/p>\n<ul>\n<li>\u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u043f\u043e\u0438\u0441\u043a\u0430 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430;<\/li>\n<li>\u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0441\u0431\u043e\u0440\u0430 \u043b\u043e\u0433-\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439.<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c <a href=\"https:\/\/www.elastic.co\/guide\/en\/beats\/filebeat\/current\/configuration-autodiscover.html\" rel=\"nofollow noopener noreferrer\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<p>  <\/p>\n<p>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0448\u0430\u0433\u043e\u0432:<\/p>\n<p>  <\/p>\n<ol>\n<li>\u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a \u0432\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 <em>container<\/em>, \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043d\u0430 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c \u044d\u0442\u0430\u043f\u0435, \u0438\u0437 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430.<\/li>\n<li>\n<p>\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a \u0430\u0432\u0442\u043e\u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u0435 \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u043c \u0444\u0430\u0439\u043b\u0435:<br \/>  <em><code>filebeat.docker.yml<\/code><\/em><\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">filebeat.autodiscover:   providers:     # \u0438\u0441\u043a\u0430\u0442\u044c docker \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440     - type: docker       templates:         - condition:             contains:               # \u0438\u043c\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e fastapi_app               docker.container.name: fastapi_app           # \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u0441\u0431\u043e\u0440\u0430 \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430           config:             - type: container               paths:                 - \/var\/lib\/docker\/containers\/${data.docker.container.id}\/*.log               # \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u043c \u043b\u043e\u0433-\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f asgi-\u0441\u0435\u0440\u0432\u0435\u0440\u0430               exclude_lines: [&quot;^INFO:&quot;]  # \u041f\u043e\u043a\u0430 \u0431\u0443\u0434\u0435\u043c \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u043b\u043e\u0433-\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c output.console:   pretty: true<\/code><\/pre>\n<p>  <\/li>\n<\/ol>\n<p>  <\/p>\n<p>\u0412\u043e\u0442 \u0438 \u0432\u0441\u0435. \u0422\u0435\u043f\u0435\u0440\u044c filebeat \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c \u043b\u043e\u0433-\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0441 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0433\u043e \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430.<\/p>\n<p>  <\/p>\n<h3 id=\"sbor-log-soobscheniy-s-ispolzovaniem-podskazok-hints\">\u0421\u0431\u043e\u0440 \u043b\u043e\u0433-\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u043e\u043a (hints)<\/h3>\n<p>  <\/p>\n<p>Filebeat \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0430\u0432\u0442\u043e\u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u0435 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u043e\u043a.<br \/>  \u041e\u043d \u0438\u0449\u0435\u0442 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e (\u043f\u043e\u0434\u0441\u043a\u0430\u0437\u043a\u0438) \u043e \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0441\u0431\u043e\u0440\u0430 \u0432 \u043b\u0435\u0439\u0431\u043b\u0430\u0445 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430.<br \/>  \u041a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0441\u044f, Filebeat \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442, \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043b\u0438 \u043e\u043d \u043a\u0430\u043a\u0438\u0435-\u043b\u0438\u0431\u043e \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u043a\u0438, \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442 \u0434\u043b\u044f \u043d\u0435\u0433\u043e \u0441\u0431\u043e\u0440 \u0441 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0439 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0435\u0439.<\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c <a href=\"https:\/\/www.elastic.co\/guide\/en\/beats\/filebeat\/current\/configuration-autodiscover-hints.html\" rel=\"nofollow noopener noreferrer\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<p>  <\/p>\n<p>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0441\u0431\u043e\u0440\u0430 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0448\u0430\u0433\u043e\u0432:<\/p>\n<p>  <\/p>\n<ol>\n<li>\n<p>\u0423\u0434\u0430\u043b\u044f\u0435\u043c \u0448\u0430\u0431\u043b\u043e\u043d \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u0441\u0435\u0440\u0432\u0438\u0441\u0430 <strong>app<\/strong> \u0438 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u043a\u0438:<br \/>  <em><code>filebeat.docker.yml<\/code><\/em><\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">filebeat.autodiscover:   providers:     - type: docker       hints.enabled: true  # \u041f\u043e\u043a\u0430 \u0431\u0443\u0434\u0435\u043c \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u043b\u043e\u0433-\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c output.console:   pretty: true<\/code><\/pre>\n<p>  <\/li>\n<li>\n<p>\u041e\u0442\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0441\u0431\u043e\u0440 \u043b\u043e\u0433-\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u0441\u0435\u0440\u0432\u0438\u0441\u0430 <strong>log-shipper<\/strong>:<br \/>  <em><code>docker-compose.yml<\/code><\/em><\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">version: &quot;3.8&quot;  services:   app:     ...    log-shipper:     ...     labels:       co.elastic.logs\/enabled: &quot;false&quot;<\/code><\/pre>\n<p>  <\/li>\n<\/ol>\n<p>  <\/p>\n<h2 id=\"parsing-log-soobscheniy\">\u041f\u0430\u0440\u0441\u0438\u043d\u0433 \u043b\u043e\u0433-\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439<\/h2>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043b\u043e\u0433-\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u0432 Filebeat \u0435\u0441\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 (<a href=\"https:\/\/www.elastic.co\/guide\/en\/beats\/filebeat\/current\/filtering-and-enhancing-data.html\" rel=\"nofollow noopener noreferrer\">processors<\/a>).<br \/>  \u0418\u0445 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043b\u0435\u0439\u0431\u043b\u043e\u0432 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043e\u0432 \u043b\u0438\u0431\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u043c \u0444\u0430\u0439\u043b\u0435.<br \/>  \u0412\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0432\u0442\u043e\u0440\u044b\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c.<\/p>\n<p>  <\/p>\n<ol>\n<li>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043e\u0447\u0438\u0441\u0442\u0438\u043c \u043b\u043e\u0433-\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043e\u0442 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0445. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a <a href=\"https:\/\/www.elastic.co\/guide\/en\/beats\/filebeat\/current\/drop-fields.html\" rel=\"nofollow noopener noreferrer\">drop_fields<\/a>:<br \/>  <em><code>filebeat.docker.yml<\/code><\/em><\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">processors:   - drop_fields:       fields: [&quot;agent&quot;, &quot;container&quot;, &quot;ecs&quot;, &quot;log&quot;, &quot;input&quot;, &quot;docker&quot;, &quot;host&quot;]       ignore_missing: true<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043b\u043e\u0433-\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">{   &quot;@timestamp&quot;: &quot;2021-04-01T04:02:28.138Z&quot;,   &quot;@metadata&quot;: {     &quot;beat&quot;: &quot;filebeat&quot;,     &quot;type&quot;: &quot;_doc&quot;,     &quot;version&quot;: &quot;7.12.0&quot;   },   &quot;message&quot;: &quot;app-log - ERROR - [Item not found] - 1&quot;,   &quot;stream&quot;: [&quot;stdout&quot;] }<\/code><\/pre>\n<p>  <\/li>\n<li>\n<p>\u0414\u043b\u044f \u043e\u0442\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043b\u043e\u0433-\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 API \u043e\u0442 \u043b\u043e\u0433-\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 asgi-\u0441\u0435\u0440\u0432\u0435\u0440\u0430, \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043a \u043d\u0438\u043c \u0442\u0435\u0433 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 <a href=\"https:\/\/www.elastic.co\/guide\/en\/beats\/filebeat\/current\/add-tags.html\" rel=\"nofollow noopener noreferrer\">add_tags<\/a>:<br \/>  <em><code>filebeat.docker.yml<\/code><\/em><\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">processors:   - drop_fields:       ...   - add_tags:     when:       contains:         &quot;message&quot;: &quot;app-log&quot;     tags: [test-app]     target: &quot;environment&quot;<\/code><\/pre>\n<p>  <\/li>\n<li>\n<p>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0438\u0440\u0443\u0435\u043c \u043f\u043e\u043b\u0435 <em>message<\/em> \u043b\u043e\u0433-\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 <a href=\"https:\/\/www.elastic.co\/guide\/en\/beats\/filebeat\/current\/dissect.html\" rel=\"nofollow noopener noreferrer\">dissect<\/a> \u0438 \u0443\u0434\u0430\u043b\u0438\u043c \u0435\u0433\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <a href=\"https:\/\/www.elastic.co\/guide\/en\/beats\/filebeat\/current\/drop-fields.html\" rel=\"nofollow noopener noreferrer\">drop_fields<\/a>:<br \/>  <em><code>filebeat.docker.yml<\/code><\/em><\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">processors:   - drop_fields:     ...   - add_tags:     ...  - dissect:      when:        contains:          &quot;message&quot;: &quot;app-log&quot;      tokenizer: 'app-log - %{log-level} - [%{event.name}] - %{event.message}'      field: &quot;message&quot;      target_prefix: &quot;&quot;  - drop_fields:      when:        contains:          &quot;message&quot;: &quot;app-log&quot;      fields: [&quot;message&quot;]      ignore_missing: true<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043b\u043e\u0433-\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">{   &quot;@timestamp&quot;: &quot;2021-04-02T08:29:07.349Z&quot;,   &quot;@metadata&quot;: {     &quot;beat&quot;: &quot;filebeat&quot;,     &quot;type&quot;: &quot;_doc&quot;,     &quot;version&quot;: &quot;7.12.0&quot;   },   &quot;log-level&quot;: &quot;ERROR&quot;,   &quot;event&quot;: {     &quot;name&quot;: &quot;Item not found&quot;,     &quot;message&quot;: &quot;Foo&quot;   },   &quot;environment&quot;: [     &quot;test-app&quot;   ],   &quot;stream&quot;: &quot;stdout&quot; }<\/code><\/pre>\n<p>  <\/li>\n<\/ol>\n<p>  <\/p>\n<h2 id=\"dopolnenie\">\u0414\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435<\/h2>\n<p>  <\/p>\n<p>Filebeat \u0442\u0430\u043a \u0436\u0435 \u0438\u043c\u0435\u0435\u0442 \u0433\u043e\u0442\u043e\u0432\u044b\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0441\u0431\u043e\u0440\u0430 \u0438 \u043f\u0430\u0440\u0441\u0438\u043d\u0433\u0430 \u043b\u043e\u0433-\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u0434\u043b\u044f \u0448\u0438\u0440\u043e\u043a\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0442\u0430\u043a\u0438\u0445, \u043a\u0430\u043a Nginx, Postgres \u0438 \u0442.\u0434.<br \/>  \u041e\u043d\u0438 \u043d\u0430\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f <a href=\"https:\/\/www.elastic.co\/guide\/en\/beats\/filebeat\/current\/configuration-filebeat-modules.html\" rel=\"nofollow noopener noreferrer\">\u043c\u043e\u0434\u0443\u043b\u044f\u043c\u0438<\/a>.<br \/>  \u041a \u043f\u0440\u0438\u043c\u0435\u0440\u0443 \u0434\u043b\u044f \u0441\u0431\u043e\u0440\u0430 \u043b\u043e\u0433-\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 Nginx, \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043a \u0435\u0433\u043e \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0443 \u043b\u0435\u0439\u0431\u043b:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">  co.elastic.logs\/module: &quot;nginx&quot;<\/code><\/pre>\n<p>  <\/p>\n<p>\u0438 \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u043a\u0438 \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u043c \u0444\u0430\u0439\u043b\u0435. \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0433\u043e\u0442\u043e\u0432\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u0441\u0431\u043e\u0440\u0430 \u0438 \u043f\u0430\u0440\u0441\u0438\u043d\u0433\u0430 \u043b\u043e\u0433-\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 + \u0443\u0434\u043e\u0431\u043d\u044b\u0439 dashboard \u0432 Kibana.<\/p>\n<p>  <\/p>\n<p>\u0412\u0441\u0435\u043c \u0441\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435!<\/p>\n<\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/550352\/\"> https:\/\/habr.com\/ru\/post\/550352\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\">\n<p>\u0412 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445 \u043a \u043c\u043e\u0435\u043c\u0443 <a href=\"https:\/\/habr.com\/ru\/post\/548998\/\">\u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u0443<\/a>, \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0449\u0435\u043c\u0443 \u043e \u043f\u0430\u0440\u0441\u0438\u043d\u0433\u0435 \u043b\u043e\u0433\u043e\u0432 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Fluent-bit, \u0431\u044b\u043b\u043e \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043e \u0434\u0432\u0435 \u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u044b: <a href=\"https:\/\/www.elastic.co\/guide\/en\/beats\/filebeat\/current\/filebeat-overview.html\" rel=\"nofollow noopener noreferrer\">Filebeat<\/a> \u0438 <a href=\"https:\/\/vector.dev\" rel=\"nofollow noopener noreferrer\">Vector<\/a>. \u042d\u0442\u043e\u0442 \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043a\u0430\u043a \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0431\u043e\u0440 \u0438 \u043f\u0430\u0440\u0441\u0438\u043d\u0433 \u043b\u043e\u0433-\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 Filebeat.<\/p>\n<p>  <\/p>\n<p><strong>\u0426\u0435\u043b\u044c \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u0430:<\/strong> \u041e\u0440\u0433\u0430\u043d\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0431\u043e\u0440 \u0438 \u043f\u0430\u0440\u0441\u0438\u043d\u0433 \u043b\u043e\u0433-\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Filebeat.<\/p>\n<p>  <\/p>\n<p><strong>\u0414\u0438\u0441\u043a\u043b\u0435\u0439\u043c\u0435\u0440:<\/strong> \u0422\u0443\u0442\u043e\u0440\u0438\u0430\u043b \u043d\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0433\u043e\u0442\u043e\u0432\u044b\u0445 \u0434\u043b\u044f \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u0435\u043d\u0430 \u0440\u0435\u0448\u0435\u043d\u0438\u0439, \u043e\u043d \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u0441 \u0446\u0435\u043b\u044c\u044e \u043f\u043e\u043c\u043e\u0447\u044c \u0442\u0435\u043c \u043a\u0442\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442 \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u044c\u0441\u044f \u0441 filebeat \u0438 \u0434\u043b\u044f \u0437\u0430\u043a\u0440\u0435\u043f\u043b\u0435\u043d\u0438\u044f \u0438\u0437\u0443\u0447\u0435\u043d\u043d\u043e\u0433\u043e \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0430 \u0430\u0432\u0442\u043e\u0440\u043e\u043c. \u0422\u0430\u043a \u0436\u0435 \u0432 \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u0435 \u043d\u0435 \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0434\u043e\u0441\u0442\u0430\u0432\u0449\u0438\u043a\u043e\u0432 \u043b\u043e\u0433\u043e\u0432. \u0421\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 <a href=\"https:\/\/sematext.com\/blog\/logstash-alternatives\/\" rel=\"nofollow noopener noreferrer\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<p>  <\/p>\n<p>\u041a\u043e\u043c\u0443 \u0434\u0430\u043d\u043d\u0430\u044f \u0442\u0435\u043c\u0430 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0430, \u043f\u0440\u043e\u0448\u0443 \u043f\u043e\u0434 \u043a\u0430\u0442:)<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-320767","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/320767","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=320767"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/320767\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=320767"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=320767"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=320767"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}