{"id":165059,"date":"2013-01-22T02:17:03","date_gmt":"2013-01-21T22:17:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=165059"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=165059","title":{"rendered":"<span class=\"post_title\">\u0421\u043e\u0431\u0438\u0440\u0430\u0435\u043c, \u043f\u0430\u0440\u0441\u0438\u043c \u0438 \u043e\u0442\u0434\u0430\u0451\u043c \u043b\u043e\u0433\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Logstash<\/span>"},"content":{"rendered":"<div class=\"content html_format\">   \t\u041f\u0440\u0438\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e.<\/p>\n<p>  \u0422\u0430\u043a \u0443\u0436 \u0441\u043b\u043e\u0436\u0438\u043b\u043e\u0441\u044c, \u0447\u0442\u043e \u043f\u043e \u0434\u043e\u043b\u0433\u0443 \u0440\u0430\u0431\u043e\u0442\u044b \u043c\u043d\u0435 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0443\u0434\u0435\u043b\u044f\u0442\u044c \u043b\u043e\u0433\u0430\u043c. \u042d\u0442\u043e \u0438 \u0443\u0447\u0430\u0441\u0442\u0438\u0435 \u0432 \u0432\u044b\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u043f\u0440\u0430\u0432\u0438\u043b \u0438 \u043f\u043e\u043b\u0438\u0442\u0438\u043a \u0441\u0431\u043e\u0440\u0430\/\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f\/\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043b\u043e\u0433\u043e\u0432, \u044d\u0442\u043e \u0438 \u0440\u0430\u0437\u0431\u043e\u0440 \u0440\u0430\u0437\u043d\u044b\u0445 \u0438\u043d\u0446\u0438\u0434\u0435\u043d\u0442\u043e\u0432 \u0438 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u0435 \u0430\u043d\u043e\u043c\u0430\u043b\u0438\u0439. \u0417\u0430 \u0441\u0443\u0442\u043a\u0438 \u043d\u0430\u0448\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b, \u0441\u0435\u0440\u0432\u0438\u0441\u044b \u0438 \u0441\u0435\u0440\u0432\u0435\u0440\u044b \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u044e\u0442 \u041e\u0427\u0415\u041d\u042c \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043b\u043e\u0433\u043e\u0432. \u0418 \u043f\u043e\u0442\u0440\u0435\u0431\u043d\u043e\u0441\u0442\u044c \u043a\u043e\u043f\u0430\u043d\u0438\u044f \u0432 \u043b\u043e\u0433\u0430\u0445 \u0440\u0430\u0441\u0442\u0451\u0442 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e.<br \/>  \u041c\u043d\u0435 \u0434\u043e\u0432\u0435\u043b\u043e\u0441\u044c \u043f\u043e\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043a\u043e\u043c\u043c\u0435\u0440\u0447\u0435\u0441\u043a\u0438\u043c\u0438 \u043b\u043e\u0433-\u043c\u0435\u043d\u0435\u0434\u0436\u043c\u0435\u043d\u0442 \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u0430\u043c\u0438 \u0442\u0438\u043f\u0430 ArcSight, RSA Envision, Q1 Labs. \u0423 \u044d\u0442\u0438\u0445 \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u043e\u0432 \u0435\u0441\u0442\u044c \u043a\u0430\u043a \u043f\u043b\u044e\u0441\u044b, \u0442\u0430\u043a \u0438 \u043c\u0438\u043d\u0443\u0441\u044b. \u041d\u043e \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 \u0440\u0435\u0447\u044c \u043f\u043e\u0439\u0434\u0451\u0442 \u043d\u0435 \u043e \u043d\u0438\u0445. <br \/>  \u0420\u0435\u0447\u044c \u0431\u0443\u0434\u0435\u0442 \u043e <a href=\"http:\/\/www.logstash.net\/\">Logstash<\/a>.<\/p>\n<p>  \u0427\u0442\u043e \u0436\u0435 \u0442\u0430\u043a\u043e\u0435 Logstash? \u0417\u0430\u0447\u0435\u043c \u043e\u043d \u043d\u0443\u0436\u0435\u043d? \u0427\u0442\u043e \u043e\u043d \u0443\u043c\u0435\u0435\u0442?<br \/>  <a name=\"habracut\"><\/a><br \/>  Logstash \u2014 \u044d\u0442\u043e \u043e\u0440\u0443\u0434\u0438\u0435 \u0434\u043b\u044f \u0441\u0431\u043e\u0440\u0430, \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0438 \u0438 \u043d\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043b\u043e\u0433\u043e\u0432. \u041e\u043d\u043e \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u044b\u043c \u0438 open source \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435\u043c. \u0422\u0438\u043f \u043b\u0438\u0446\u0435\u043d\u0437\u0438\u0438 Apache 2.0. <\/p>\n<p>  \u041f\u0435\u0440\u0432\u043e\u0439 \u043c\u043e\u0451 \u0437\u043d\u0430\u043a\u043e\u043c\u0441\u0442\u0432\u043e \u0441 LS (Logstash) \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u043e \u0431\u043e\u043b\u0435\u0435 \u0433\u043e\u0434\u0430 \u043d\u0430\u0437\u0430\u0434, \u0438 \u0441 \u0442\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u044f \u043e\u0447\u0435\u043d\u044c \u043f\u043b\u043e\u0442\u043d\u043e \u043d\u0430 \u043d\u0435\u0433\u043e \u043f\u043e\u0434\u0441\u0435\u043b. \u041c\u043d\u0435 \u043d\u0440\u0430\u0432\u0438\u0442\u0441\u044f \u0435\u0433\u043e \u0438\u0434\u0435\u044f \u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438. \u0414\u043b\u044f \u043c\u0435\u043d\u044f Logstash \u2014 \u044d\u0442\u043e \u043f\u043e\u0434\u043e\u0431\u0438\u0435 \u043c\u044f\u0441\u043e\u0440\u0443\u0431\u043a\u0438. \u041d\u0435\u0432\u0430\u0436\u043d\u043e \u0447\u0442\u043e \u0437\u0430\u0445\u043e\u0434\u0438\u0442 \u0432 \u043d\u0435\u0451, \u043d\u043e \u043f\u043e\u0441\u043b\u0435 \u043d\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u0439, \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u043a\u0440\u0430\u0441\u0438\u0432\u043e \u0438 \u043f\u043e\u043d\u044f\u0442\u043d\u043e \u043e\u0444\u043e\u0440\u043c\u043b\u0435\u043d\u043d\u0430\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f.<\/p>\n<p>  \u0424\u043e\u0440\u043c\u0430\u0442 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 Logstash&#8217;\u0430 \u043f\u0440\u043e\u0441\u0442 \u0438 \u043f\u043e\u043d\u044f\u0442\u0435\u043d. \u041e\u043d \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u0442\u0440\u0451\u0445 \u0447\u0430\u0441\u0442\u0435\u0439:<\/p>\n<pre><code class=\"bash\">input {   ... }  filter {   ... }  output {   ... } <\/code><\/pre>\n<p>  \u0412\u0445\u043e\u0434\u043d\u044b\u0445, \u0444\u0438\u043b\u044c\u0442\u0440\u0443\u044e\u0449\u0438\u0445 \u0438 \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0445 (\u0438\u043b\u0438 \u0432\u044b\u0445\u043e\u0434\u044f\u0449\u0438\u0445?) \u0431\u043b\u043e\u043a\u043e\u0432 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043b\u044e\u0431\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e. \u0412\u0441\u0451 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0432\u0430\u0448\u0438\u0445 \u043f\u043e\u0442\u0440\u0435\u0431\u043d\u043e\u0441\u0442\u0435\u0439 \u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439 \u0436\u0435\u043b\u0435\u0437\u0430.<br \/>  \u041f\u0443\u0441\u0442\u044b\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 \u0438 \u0441\u0442\u0440\u043e\u043a\u0438 \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0438\u0435\u0441\u044f \u0441 <b>#<\/b> \u2014 Logstash \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u0443\u0435\u0442. \u0422\u0430\u043a \u0447\u0442\u043e \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432 \u043d\u0435 \u0432\u044b\u0437\u043e\u0432\u0435\u0442 \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u043f\u0440\u043e\u0431\u043b\u0435\u043c.<\/p>\n<h4>1. INPUT<\/h4>\n<p>\u0414\u0430\u043d\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u0445\u043e\u0434\u043d\u043e\u0439 \u0442\u043e\u0447\u043a\u043e\u0439 \u0434\u043b\u044f \u043b\u043e\u0433\u043e\u0432. \u0412 \u043d\u0451\u043c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u043f\u043e \u043a\u0430\u043a\u0438\u043c \u043a\u0430\u043d\u0430\u043b\u0430\u043c \u0431\u0443\u0434\u0443\u0442 \u043b\u043e\u0433\u0438 \u043f\u043e\u043f\u0430\u0434\u0430\u0442\u044c \u0432 Logstash. <br \/>  \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u043f\u043e\u043f\u044b\u0442\u0430\u044e\u0441\u044c \u0432\u0430\u0441 \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442 \u0441 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u043c\u0438 \u0442\u0438\u043f\u0430\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e \u2014 \u044d\u0442\u043e file, tcp \u0438 udp.   <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">1.1 file<\/b><\/p>\n<div class=\"spoiler_text\">\u041f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438, \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u043b\u043e\u0433-\u0444\u0430\u0439\u043b\u0430\u043c\u0438:  <\/p>\n<pre><code class=\"bash\">input {   file {     type =&gt; &quot;some_access_log&quot;     path =&gt; [ &quot;\/var\/log\/vs01\/*.log&quot;, &quot;\/var\/log\/vs02\/*.log&quot; ]     exclude =&gt; [ &quot;*.gz&quot;, &quot;*.zip&quot;, &quot;*.rar&quot; ]     start_position =&gt; &quot;end&quot;     stat_interval =&gt; 1     discover_interval =&gt; 30   } } <\/code><\/pre>\n<p>  \u041f\u043e\u0441\u0442\u0440\u043e\u0447\u043d\u043e\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a:  <\/p>\n<pre><code class=\"bash\">type =&gt; &quot;some_access_log&quot; <\/code><\/pre>\n<p>\u0442\u0438\u043f\/\u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043b\u043e\u0433\u0430. \u041f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0431\u043b\u043e\u043a\u043e\u0432, \u0443\u0434\u043e\u0431\u043d\u043e \u0438\u0445 \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u0442\u044c \u0434\u043b\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u0432 filter \u0438\u043b\u0438 output.<\/p>\n<pre><code class=\"bash\">path =&gt; [ &quot;\/var\/log\/vs01\/*.log&quot;, &quot;\/var\/log\/vs02\/*.log&quot; ] <\/code><\/pre>\n<p>\u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0443\u0442\u044c \u043a \u043b\u043e\u0433-\u0444\u0430\u0439\u043b\u0430\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0434\u043b\u0435\u0436\u0430\u0442 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0435. \u041f\u0443\u0442\u044c \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u044b\u043c (\/path\/to\/logs\/), \u0430 \u043d\u0435 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c (..\/..\/some\/other\/path\/). <\/p>\n<pre><code class=\"bash\">exclude =&gt; [ &quot;*.gz&quot;, &quot;*.zip&quot;, &quot;*.rar&quot; ] <\/code><\/pre>\n<p>\u0438\u0441\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0438\u0437 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0444\u0430\u0439\u043b\u044b \u0441 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c\u0438 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f\u043c\u0438.<\/p>\n<pre><code class=\"bash\">start_position =&gt; &quot;end&quot; <\/code><\/pre>\n<p>\u0436\u0434\u0451\u0442 \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u044f \u043d\u043e\u0432\u044b\u0445 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u0432 \u043a\u043e\u043d\u0446\u0435 \u0444\u0430\u0439\u043b\u0430. \u041f\u0440\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0443\u0436\u0435 \u0438\u043c\u0435\u044e\u0449\u0438\u0445\u0441\u044f \u043b\u043e\u0433\u043e\u0432, \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u00abbeginning\u00bb, \u0442\u043e\u0433\u0434\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043b\u043e\u0433\u043e\u0432 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442\u044c \u043f\u043e\u0441\u0442\u0440\u043e\u0447\u043d\u043e \u0441 \u043d\u0430\u0447\u0430\u043b\u0430 \u0444\u0430\u0439\u043b\u043e\u0432.<\/p>\n<pre><code class=\"bash\">stat_interval =&gt; 1 <\/code><\/pre>\n<p>\u043a\u0430\u043a \u0447\u0430\u0441\u0442\u043e (\u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0430\u0445) \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u0444\u0430\u0439\u043b\u044b \u043d\u0430 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f. \u041f\u0440\u0438 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u0442\u0441\u044f \u0447\u0430\u0441\u0442\u043e\u0442\u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0445 \u0432\u044b\u0437\u043e\u0432\u043e\u0432, \u043d\u043e \u0442\u0430\u043a \u0436\u0435 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0442\u0441\u044f \u0432\u0440\u0435\u043c\u044f \u0447\u0442\u0435\u043d\u0438\u044f \u043d\u043e\u0432\u044b\u0445 \u0441\u0442\u0440\u043e\u043a.<\/p>\n<pre><code class=\"bash\">discover_interval =&gt; 30 <\/code><\/pre>\n<p>\u0432\u0440\u0435\u043c\u044f (\u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0430\u0445) \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u043d\u043e\u0432\u043b\u0451\u043d \u0441\u043f\u0438\u0441\u043e\u043a \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0445 \u0432 <b>path<\/b>.  <\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">1.2 tcp<\/b><\/p>\n<div class=\"spoiler_text\">\u041f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438, \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043b\u043e\u0433\u0430\u043c\u0438 \u0443\u0434\u0430\u043b\u0451\u043d\u043d\u044b\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432:  <\/p>\n<pre><code class=\"bash\">input {   tcp {     type =&gt; &quot;webserver_prod&quot;     data_timeout =&gt; 10     mode =&gt; &quot;server&quot;     host =&gt; &quot;192.168.3.12&quot;     port =&gt; 3337   } } <\/code><\/pre>\n<p>  \u041f\u043e\u0441\u0442\u0440\u043e\u0447\u043d\u043e\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a:  <\/p>\n<pre><code class=\"bash\">type =&gt; &quot;webserver_prod&quot; <\/code><\/pre>\n<p>\u0442\u0438\u043f\/\u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043b\u043e\u0433\u0430.<\/p>\n<pre><code class=\"bash\">data_timeout =&gt; 10 <\/code><\/pre>\n<p>\u0432\u0440\u0435\u043c\u044f (\u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0430\u0445), \u043f\u043e \u0438\u0441\u0442\u0435\u0447\u0435\u043d\u0438\u0438 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043d\u0435 \u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0435 tcp \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043a\u0440\u044b\u0442\u043e. \u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <b>-1<\/b> \u2014 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043a\u0440\u044b\u0442\u043e.<\/p>\n<pre><code class=\"bash\">mode =&gt; &quot;server&quot; host =&gt; &quot;192.168.3.12&quot; port =&gt; 3337 <\/code><\/pre>\n<p>\u0432 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 Logstash \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c, \u0438 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442 \u0441\u043b\u0443\u0448\u0430\u0442\u044c \u043d\u0430 192.168.3.12:3337. \u041f\u0440\u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435 <b>mode =&gt; \u00abclient\u00bb<\/b> Logstash \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u0441\u043e\u0435\u0434\u0438\u043d\u044f\u0442\u0441\u044f \u043a \u0443\u0434\u0430\u043b\u0451\u043d\u043d\u043e\u043c\u0443 ip:port \u0434\u043b\u044f \u0437\u0430\u0431\u043e\u0440\u0430 \u043b\u043e\u0433\u043e\u0432.<\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">1.3 udp<\/b><\/p>\n<div class=\"spoiler_text\">\u0414\u043b\u044f <b>udp<\/b> \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u0435 tcp:  <\/p>\n<pre><code class=\"bash\">input {   udp {     type =&gt; &quot;webserver_prod&quot;     buffer_size =&gt; 4096     host =&gt; &quot;192.168.3.12&quot;     port =&gt; 3337   } } <\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<h4>2. FILTER<\/h4>\n<p>\u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0431\u043b\u043e\u043a\u0435 \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u0438 \u0441 \u043b\u043e\u0433\u0430\u043c\u0438. \u042d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0438 \u0440\u0430\u0437\u0431\u0438\u0432\u043a\u0430 \u043f\u043e key=value, \u0438 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u043d\u0435\u043d\u0443\u0436\u043d\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432, \u0438 \u0437\u0430\u043c\u0435\u043d\u0430 \u0438\u043c\u0435\u044e\u0449\u0438\u0445\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439, \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 geoip \u0438\u043b\u0438 DNS \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0434\u043b\u044f \u0438\u043f-\u0430\u0434\u0440\u0435\u0441\u043e\u0432 \u0438\u043b\u0438 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0439 \u0445\u043e\u0441\u0442\u043e\u0432. <\/p>\n<p>  \u041d\u0430 \u043f\u0435\u0440\u0432\u044b\u0439 \u0432\u0437\u0433\u043b\u044f\u0434 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u0441\u043b\u043e\u0436\u043d\u044b\u043c \u0438 \u043d\u0435\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u043c, \u043d\u043e \u044d\u0442\u043e \u043d\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u0442\u0430\u043a.  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">2.1 grok<\/b><\/p>\n<div class=\"spoiler_text\">\u041f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u0434\u043b\u044f \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u043d\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043b\u043e\u0433\u043e\u0432:  <\/p>\n<pre><code class=\"bash\">filter {   grok {     type =&gt; &quot;some_access_log&quot;     patterns_dir =&gt; &quot;\/path\/to\/patterns\/&quot;     pattern =&gt; &quot;%{IP:client} %{WORD:method} %{URIPATHPARAM:request} %{NUMBER:bytes} %{NUMBER:duration}&quot;   } } <\/code><\/pre>\n<p>  \u041f\u043e\u0441\u0442\u0440\u043e\u0447\u043d\u043e\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a:  <\/p>\n<pre><code class=\"bash\">type =&gt; &quot;apache_access&quot; <\/code><\/pre>\n<p>\u0442\u0438\u043f\/\u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043b\u043e\u0433\u0430. \u0417\u0434\u0435\u0441\u044c \u043d\u0430\u0434\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0442\u043e\u0442 \u0442\u0438\u043f (type), \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u043d \u0432 \u0431\u043b\u043e\u043a\u0435 <b>input <\/b> \u0434\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442\u044c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430.<\/p>\n<pre><code class=\"bash\">patterns_dir =&gt; &quot;\/path\/to\/patterns\/&quot; <\/code><\/pre>\n<p>\u043f\u0443\u0442\u044c \u043a \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0443, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u043c \u0448\u0430\u0431\u043b\u043e\u043d\u044b \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043b\u043e\u0433\u043e\u0432. \u0412\u0441\u0435 \u0444\u0430\u0439\u043b\u044b \u043d\u0430\u0445\u043e\u0434\u044f\u0449\u0438\u0435\u0441\u044f \u0432 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0439 \u043f\u0430\u043f\u043a\u0435 \u0431\u0443\u0434\u0443\u0442 \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u044b Logstash, \u0442\u0430\u043a \u0447\u0442\u043e \u043b\u0438\u0448\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u044b \u0442\u0430\u043c \u043d\u0435 \u0436\u0435\u043b\u0430\u0442\u0435\u043b\u044c\u043d\u044b.<\/p>\n<pre><code class=\"bash\">pattern =&gt; &quot;%{IP:client} %{WORD:method} %{URIPATHPARAM:request} %{NUMBER:bytes} %{NUMBER:duration}&quot;<\/code><\/pre>\n<p>\u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0448\u0430\u0431\u043b\u043e\u043d \u0440\u0430\u0437\u0431\u043e\u0440\u043a\u0438 \u043b\u043e\u0433\u043e\u0432. \u0428\u0430\u0431\u043b\u043e\u043d \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043b\u0438\u0431\u043e \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u043c \u0444\u0430\u0439\u043b\u0435, \u043b\u0438\u0431\u043e \u0438\u0437 \u0444\u0430\u0439\u043b\u0430 \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432. \u0427\u0442\u043e \u0431\u044b \u043d\u0435 \u043f\u0443\u0442\u0430\u0442\u044c\u0441\u044f, \u044f \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0444\u043e\u0440\u043c\u0430\u0442\u0430 \u043b\u043e\u0433\u043e\u0432 \u0441\u043e\u0437\u0434\u0430\u044e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u0448\u0430\u0431\u043b\u043e\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043f\u0440\u043e \u0448\u0430\u0431\u043b\u043e\u043d\u044b<\/b><\/p>\n<div class=\"spoiler_text\">\u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <b>grok<\/b> \u0444\u0438\u043b\u044c\u0442\u0440\u0430 \u043c\u043e\u0436\u043d\u043e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0431<b>\u043e<\/b>\u043b\u044c\u0448\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u043b\u043e\u0433\u043e\u0432 \u2014 syslog, apache, nginx, mysql \u0438\u0442\u0434, \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0445 \u0432 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u043c \u0444\u043e\u0440\u043c\u0430\u0442\u0435. <br \/>  Logstash \u0438\u043c\u0435\u0435\u0442 \u0431\u043e\u043b\u0435\u0435 120 \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432 \u0433\u043e\u0442\u043e\u0432\u044b\u0445 \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u044b\u0445 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0439 (regex). \u0422\u0430\u043a \u0447\u0442\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432 \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0430 \u043b\u043e\u0433\u043e\u0432 \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u043e\u0441\u043e\u0431\u043e\u0433\u043e \u0441\u0442\u0440\u0430\u0445\u0430 \u0438\u043b\u0438 \u043d\u0435\u0434\u043e\u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f.<\/p>\n<p>  \u0424\u043e\u0440\u043c\u0430\u0442 \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u2014 <b>NAME PATTERN<\/b>, \u0442\u043e \u0435\u0441\u0442\u044c \u043f\u043e\u0441\u0442\u0440\u043e\u0447\u043d\u043e \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0438\u043c\u044f \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u0438 \u0435\u043c\u0443 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0435 \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u043e\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435. \u041f\u0440\u0438\u043c\u0435\u0440:  <\/p>\n<pre><code class=\"bash\">NUMBER \\d+ WORD \\b\\w+\\b USERID [a-zA-Z0-9_-]+<\/code><\/pre>\n<p>  \u041c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043b\u044e\u0431\u043e\u0439 \u0440\u0430\u043d\u0435\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 \u0448\u0430\u0431\u043b\u043e\u043d:  <\/p>\n<pre><code class=\"bash\">USER %{USERID} <\/code><\/pre>\n<p>  \u0428\u0430\u0431\u043b\u043e\u043d\u044b \u043c\u043e\u0436\u043d\u043e \u0442\u0430\u043a \u0436\u0435 \u0438 \u043a\u043e\u043c\u0431\u0438\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c:  <\/p>\n<pre><code class=\"bash\">CISCOMAC (?:(?:[A-Fa-f0-9]{4}\\.){2}[A-Fa-f0-9]{4}) WINDOWSMAC (?:(?:[A-Fa-f0-9]{2}-){5}[A-Fa-f0-9]{2}) MAC (?:%{CISCOMAC}|%{WINDOWSMAC}) <\/code><\/pre>\n<p>  \u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c \u0444\u043e\u0440\u043c\u0430\u0442 \u043b\u043e\u0433\u043e\u0432 \u0443 \u043d\u0430\u0441 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439:<br \/>  <code>55.3.244.1 GET \/index.html 15824 0.043<\/code><\/p>\n<p>  \u0421\u0440\u0435\u0434\u0438 \u0433\u043e\u0442\u043e\u0432\u044b\u0445 \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432, \u043a \u0441\u0447\u0430\u0441\u0442\u044c\u044e \u0443\u0436\u0435 \u0438\u043c\u0435\u044e\u0442\u0441\u044f \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u044b\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0438 \u043d\u0435 \u043d\u0430\u0434\u043e \u043f\u0440\u0438\u0434\u0443\u043c\u044b\u0432\u0430\u0442\u044c \u043a\u043e\u043b\u0451\u0441\u043d\u043e\u0435 \u0442\u0440\u0430\u043d\u0441\u043f\u043e\u0440\u0442\u043d\u043e\u0435 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e, \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u043c\u043e\u0435 \u0432 \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u0435 \u043c\u0443\u0441\u043a\u0443\u043b\u044c\u043d\u043e\u0439 \u0441\u0438\u043b\u043e\u0439 \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430 \u0447\u0435\u0440\u0435\u0437 \u043d\u043e\u0436\u043d\u044b\u0435 \u043f\u0435\u0434\u0430\u043b\u0438 \u0438\u043b\u0438 \u0447\u0435\u0440\u0435\u0437 \u0440\u0443\u0447\u043d\u044b\u0435 \u0440\u044b\u0447\u0430\u0433\u0438 (\u044d\u0442\u043e \u044f \u043f\u0440\u043e \u0432\u0435\u043b\u043e\u0441\u0438\u043f\u0435\u0434 \u0435\u0441\u043b\u0438 \u0447\u0442\u043e). <br \/>  \u0421 \u0434\u0430\u043d\u043d\u044b\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u043c \u043b\u043e\u0433\u0430 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e pattern \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0432 \u0432\u0438\u0434\u0435 &quot;<b>%{IP:client} %{WORD:method} %{URIPATHPARAM:request} %{NUMBER:bytes} %{NUMBER:duration}<\/b>&quot;, \u0432 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0432\u0441\u0435 \u043b\u043e\u0433\u0438 \u0441 \u0434\u0430\u043d\u043d\u044b\u043c \u0444\u043e\u0440\u043c\u0430\u0442\u043e\u043c \u0431\u0443\u0434\u0443\u0442 \u0443\u0436\u0435 \u0438\u043c\u0435\u0442\u044c \u043d\u0435\u043a\u0443\u044e \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443.<br \/>  \u041f\u043e\u0441\u043b\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043d\u0430\u0448\u0430 \u0441\u0442\u0440\u043e\u043a\u0430 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:  <\/p>\n<blockquote><p>client: 55.3.244.1<br \/>  method: GET<br \/>  request: \/index.html<br \/>  bytes: 15824<br \/>  duration: 0.043  <\/p><\/blockquote>\n<p>  \u0421\u043e \u0441\u043f\u0438\u0441\u043a\u043e\u043c \u0433\u043e\u0442\u043e\u0432\u044b\u0445 grok-\u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f <a href=\"https:\/\/github.com\/logstash\/logstash\/tree\/v1.1.9\/patterns\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p><\/div>\n<\/div>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">2.2 mutate<\/b><\/p>\n<div class=\"spoiler_text\">\u041f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u0434\u043b\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f\/\u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0438\u0437 \u043b\u043e\u0433\u043e\u0432:  <\/p>\n<pre><code class=\"bash\">filter {   mutate {     type =&gt; &quot;apache_access&quot;     remove =&gt; [ &quot;client&quot; ]     rename =&gt; [ &quot;HOSTORIP&quot;, &quot;client_ip&quot; ]     gsub =&gt; [ &quot;message&quot;, &quot;\\\\\/&quot;, &quot;_&quot; ]     add_field =&gt; [ &quot;sample1&quot;, &quot;from %{clientip}&quot; ]   } } <\/code><\/pre>\n<p>  \u041f\u043e\u0441\u0442\u0440\u043e\u0447\u043d\u043e\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a:  <\/p>\n<pre><code class=\"bash\">type =&gt; &quot;apache_access&quot; <\/code><\/pre>\n<p>\u0442\u0438\u043f\/\u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043b\u043e\u0433\u0430. \u0423\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0442\u0438\u043f (type) \u043b\u043e\u0433\u043e\u0432 \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442\u044c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430.<\/p>\n<pre><code class=\"bash\">remove =&gt; [ &quot;client&quot; ] <\/code><\/pre>\n<p>\u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0432\u0441\u0435\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u043c\u0435\u044e\u0449\u0438\u0445 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043f\u043e\u043b\u044f <b>client<\/b>. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0439 \u043f\u043e\u043b\u0435\u0439.<\/p>\n<pre><code class=\"bash\">rename =&gt; [ &quot;HOSTORIP&quot;, &quot;client_ip&quot; ] <\/code><\/pre>\n<p>\u043f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043f\u043e\u043b\u044f <b>HOSTORIP<\/b> \u0432 <b>client_ip<\/b>.<\/p>\n<pre><code class=\"bash\">gsub =&gt; [ &quot;message&quot;, &quot;\\\\\/&quot;, &quot;_&quot; ] <\/code><\/pre>\n<p>\u0437\u0430\u043c\u0435\u043d\u0430 \u0432\u0441\u0435\u0445 &quot;\/&quot; \u043d\u0430 &quot;_&quot; \u0432 \u043f\u043e\u043b\u0435 <b>messages<\/b>.<\/p>\n<pre><code class=\"bash\">add_field =&gt; [ &quot;sample1&quot;, &quot;from %{clientip}&quot; ] <\/code><\/pre>\n<p>\u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043d\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u043b\u044f \u00absample1\u00bb \u0441\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c \u00abfrom %{clientip}\u00bb. \u0414\u043e\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445.  <\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">2.3 date<\/b><\/p>\n<div class=\"spoiler_text\">\u041f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430:  <\/p>\n<pre><code class=\"bash\">filter {   date {     type =&gt; &quot;apache_access&quot;     match =&gt; [ &quot;timestamp&quot;, &quot;MMM dd HH:mm:ss&quot; ]   } } <\/code><\/pre>\n<p>  \u041f\u043e\u0441\u0442\u0440\u043e\u0447\u043d\u043e\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a:  <\/p>\n<pre><code class=\"bash\">type =&gt; &quot;apache_access&quot; <\/code><\/pre>\n<p>\u0442\u0438\u043f\/\u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043b\u043e\u0433\u0430. \u0423\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0442\u0438\u043f (type) \u043b\u043e\u0433\u043e\u0432 \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442\u044c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430.<\/p>\n<pre><code class=\"bash\">match =&gt; [ &quot;timestamp&quot;, &quot;MMM dd HH:mm:ss&quot; ] <\/code><\/pre>\n<p>\u0432\u0440\u0435\u043c\u0435\u043d\u043d<b>\u0430<\/b>\u044f \u043c\u0435\u0442\u043a\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u044f. \u0412\u0430\u0436\u043d\u0430\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0434\u043b\u044f \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u0439 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438 \u0438\u043b\u0438 \u0432\u044b\u0431\u043e\u0440\u043a\u0438 \u043b\u043e\u0433\u043e\u0432. \u0415\u0441\u043b\u0438 \u0432 \u043b\u043e\u0433\u0430\u0445 \u0432\u0440\u0435\u043c\u044f \u0443\u043a\u0430\u0437\u0430\u043d\u043e \u0432 unix timestamp (squid), \u0442\u043e \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c match =&gt; [ \u00abtimestamp\u00bb, \u00abUNIX\u00bb ]  <\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">2.4 kv<\/b><\/p>\n<div class=\"spoiler_text\">\u041f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043b\u043e\u0433\u043e\u0432 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 key=value:  <\/p>\n<pre><code class=\"bash\">filter {   kv {     type =&gt; &quot;custom_log&quot;     value_split =&gt; &quot;=:&quot;     fields =&gt; [&quot;reminder&quot;]     field_split =&gt; &quot;\\t?&&quot;   } } <\/code><\/pre>\n<p>  \u041f\u043e\u0441\u0442\u0440\u043e\u0447\u043d\u043e\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a:  <\/p>\n<pre><code class=\"bash\">type =&gt; &quot;custom_log&quot; <\/code><\/pre>\n<p>\u0442\u0438\u043f\/\u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043b\u043e\u0433\u0430. \u0423\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0442\u0438\u043f (type) \u043b\u043e\u0433\u043e\u0432 \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442\u044c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430.<\/p>\n<pre><code class=\"bash\">value_split =&gt; &quot;=:&quot; <\/code><\/pre>\n<p>\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0438\u043c\u0432\u043e\u043b\u044b &quot;=&quot; \u0438 &quot;:&quot; \u0434\u043b\u044f \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043a\u043b\u044e\u0447\u0430-\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f.<\/p>\n<pre><code class=\"bash\">fields =&gt; [&quot;reminder&quot;] <\/code><\/pre>\n<p>\u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043f\u043e\u043b\u044f \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0438\u0441\u043a\u0430\u0442\u044c &#8216;\u043a\u043b\u044e\u0447=\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435&#8217;. \u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0440\u0430\u0437\u0431\u0438\u0432\u043a\u0430 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442\u044c \u0434\u043b\u044f \u0432\u0441\u0435\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 \u043b\u043e\u0433\u0430.<\/p>\n<pre><code class=\"bash\">field_split =&gt; &quot;\\t?&&quot; <\/code><\/pre>\n<p>\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0438\u043c\u0432\u043e\u043b\u044b &quot;\\t?&#038;&quot; \u0434\u043b\u044f \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043a\u043b\u044e\u0447\u0435\u0439. <i>\\t \u2014 \u0437\u043d\u0430\u043a \u0442\u0430\u0431\u0443\u043b\u044f\u0442\u043e\u0440\u0430<\/i>  <\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">2.5 multiline<\/b><\/p>\n<div class=\"spoiler_text\">\u041f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u0434\u043b\u044f \u00ab\u0441\u043a\u043b\u0435\u0438\u0432\u0430\u043d\u0438\u044f\u00bb \u043c\u043d\u043e\u0433\u043e\u0441\u0442\u0440\u043e\u0447\u043d\u044b\u0445 \u043b\u043e\u0433\u043e\u0432 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 Java stack trace):  <\/p>\n<pre><code class=\"bash\">filter {   multiline {     type =&gt; &quot;java_log&quot;     pattern =&gt; &quot;^\\s&quot;     what =&gt; &quot;previous&quot;   } } <\/code><\/pre>\n<p>  \u041f\u043e\u0441\u0442\u0440\u043e\u0447\u043d\u043e\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a:  <\/p>\n<pre><code class=\"bash\">type =&gt; &quot;java_log&quot; <\/code><\/pre>\n<p>\u0442\u0438\u043f\/\u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043b\u043e\u0433\u0430. \u0423\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0442\u0438\u043f (type) \u043b\u043e\u0433\u043e\u0432 \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442\u044c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430.<\/p>\n<pre><code class=\"bash\">pattern =&gt; &quot;^\\s&quot; <\/code><\/pre>\n<p>\u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u043e\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435<\/p>\n<pre><code class=\"bash\">what =&gt; &quot;previous&quot; <\/code><\/pre>\n<p>\u043f\u0440\u0438 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0448\u0430\u0431\u043b\u043e\u043d\u0443 \u00abpattern\u00bb \u0441\u0442\u0440\u043e\u043a\u0430 \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0438\u0442 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 (previous) \u0441\u0442\u0440\u043e\u043a\u0435.<\/p><\/div>\n<\/div>\n<h4>3. OUTPUT<\/h4>\n<p>\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u044d\u0442\u043e\u0433\u043e \u0431\u043b\u043e\u043a\u0430\/\u043c\u0435\u0442\u043e\u0434\u0430 \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u0441\u0430\u043c\u043e \u0437\u0430 \u0441\u0435\u0431\u044f \u2014 \u0432 \u043d\u0451\u043c \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0434\u043b\u044f \u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439. \u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u043c \u0431\u043b\u043e\u043a\u0430\u043c, \u0437\u0434\u0435\u0441\u044c \u043c\u043e\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043b\u044e\u0431\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u043f\u043e\u0434\u0431\u043b\u043e\u043a\u043e\u0432.  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">3.1 stdout<\/b><\/p>\n<div class=\"spoiler_text\">\u041f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u0434\u043b\u044f \u0432\u044b\u0432\u043e\u0434\u0430 \u043b\u043e\u0433\u043e\u0432 \u0432 standard output:  <\/p>\n<pre><code class=\"bash\">output {   stdout {     type =&gt; &quot;custom_log&quot;     message =&gt; &quot;IP - %{clientip}. Full message: %{@message}. End of line.&quot;   } } <\/code><\/pre>\n<pre><code class=\"bash\">type =&gt; &quot;custom_log&quot; <\/code><\/pre>\n<p>\u0442\u0438\u043f\/\u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043b\u043e\u0433\u0430.<\/p>\n<pre><code class=\"bash\">message =&gt; &quot;clIP - %{clientip}. Full message: %{@message}. End of line.&quot; <\/code><\/pre>\n<p>\u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0444\u043e\u0440\u043c\u0430\u0442 \u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0435\u0433\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f. \u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u043f\u043e\u0441\u043b\u0435 grok-\u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0438.  <\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">3.2 file<\/b><\/p>\n<div class=\"spoiler_text\">\u041f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u0434\u043b\u044f \u0437\u0430\u043f\u0438\u0441\u0438 \u043b\u043e\u0433\u043e\u0432 \u0432 \u0444\u0430\u0439\u043b:  <\/p>\n<pre><code class=\"bash\">output {   file {     type =&gt; &quot;custom_log&quot;     flush_interval =&gt; 5     gzip=&gt; true     path =&gt; &quot;\/var\/log\/custom\/%{clientip}\/%{type}&quot;     message_format =&gt; &quot;ip: %{clientip} request:%{requri}&quot;   } } <\/code><\/pre>\n<pre><code class=\"bash\">type =&gt; &quot;custom_log&quot; <\/code><\/pre>\n<p>\u0442\u0438\u043f\/\u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043b\u043e\u0433\u0430.<\/p>\n<pre><code class=\"bash\">flush_interval =&gt; 5 <\/code><\/pre>\n<p>\u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b \u0437\u0430\u043f\u0438\u0441\u0438 \u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439. \u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <b>0<\/b> \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u043a\u0430\u0436\u0434\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435.<\/p>\n<pre><code class=\"bash\">gzip=&gt; true <\/code><\/pre>\n<p>\u0444\u0430\u0439\u043b \u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u0431\u0443\u0434\u0435\u0442 \u0441\u0436\u0430\u0442 Gzip.<\/p>\n<pre><code class=\"bash\">path =&gt; &quot;\/var\/log\/custom\/%{clientip}\/%{type}&quot; <\/code><\/pre>\n<p>\u043f\u0443\u0442\u044c \u0438 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u0430 \u043a\u0443\u0434\u0430 \u0431\u0443\u0434\u0443\u0442 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c\u0441\u044f \u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0438\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f. \u041c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435. \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435, \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0433\u043e IP \u0430\u0434\u0440\u0435\u0441\u0430 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u043d\u0430 \u0441\u0432\u043e\u044f \u043f\u0430\u043f\u043a\u0430 \u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0431\u0443\u0434\u0443\u0442 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u0432 \u0444\u0430\u0439\u043b \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 %{type}.<\/p>\n<pre><code class=\"bash\">message_format =&gt; &quot;ip: %{clientip} request:%{requri}&quot; <\/code><\/pre>\n<p>\u0444\u043e\u0440\u043c\u0430\u0442 \u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0435\u0433\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f.  <\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">3.3 elasticsearch<\/b><\/p>\n<div class=\"spoiler_text\">\u041f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u0434\u043b\u044f \u0437\u0430\u043f\u0438\u0441\u0438 \u043b\u043e\u0433\u043e\u0432 \u0432 \u0431\u0430\u0437\u0443 Elasticsearch:  <\/p>\n<pre><code class=\"bash\">output {   elasticsearch {     type =&gt; &quot;custom_log&quot;     cluster =&gt; &quot;es_logs&quot;     embedded =&gt; false     host =&gt; &quot;192.168.1.1&quot;     port =&gt; &quot;19300&quot;     index =&gt; &quot;logs-%{+YYYY.MM.dd}&quot;    } } <\/code><\/pre>\n<pre><code class=\"bash\">type =&gt; &quot;custom_log&quot; <\/code><\/pre>\n<p>\u0442\u0438\u043f\/\u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043b\u043e\u0433\u0430.<\/p>\n<pre><code class=\"bash\">cluster =&gt; &quot;es_logs&quot; <\/code><\/pre>\n<p>\u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0433\u043e \u0432 <b>cluster.name<\/b> \u0432 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u0447\u043d\u043e\u043c \u0444\u0430\u0439\u043b\u0435 Elasticsearch.<\/p>\n<pre><code class=\"bash\">embedded =&gt; false <\/code><\/pre>\n<p>\u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043a\u0430\u043a\u0443\u044e \u0431\u0430\u0437\u0443 Elasticsearch \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u044e\u044e \u0438\u043b\u0438 \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u044e\u044e.<\/p>\n<pre><code class=\"bash\">port =&gt; &quot;19300&quot; <\/code><\/pre>\n<p>\u0442\u0440\u0430\u043d\u0441\u043f\u043e\u0440\u0442\u043d\u044b\u0439 port Elasticsearch.<\/p>\n<pre><code class=\"bash\">host =&gt; &quot;192.168.1.1&quot; <\/code><\/pre>\n<p>IP \u0430\u0434\u0440\u0435\u0441 Elasticsearch<\/p>\n<pre><code class=\"bash\">index =&gt; &quot;logs-%{+YYYY.MM.dd}&quot;  <\/code><\/pre>\n<p>\u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u043a\u0443\u0434\u0430 \u0431\u0443\u0434\u0443\u0442 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u043b\u043e\u0433\u0438.  <\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">3.4 email<\/b><\/p>\n<div class=\"spoiler_text\">\u0414\u0430\u043d\u043d\u044b\u0439 \u043f\u043b\u0430\u0433\u0438\u043d \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u0430\u043b\u0435\u0440\u0442\u043e\u0432. \u041c\u0438\u043d\u0443\u0441 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043b\u044e\u0431\u044b\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u0439 (\u0432 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435 \u043a\u0430\u043a \u0438 \u043b\u044e\u0431\u044b\u0445 \u0434\u0440\u0443\u0433\u0438\u0445 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a) \u0442\u0440\u0435\u0431\u0443\u044e\u0442 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a logstash \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b, \u043d\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0433\u043e\u0432\u043e\u0440\u0438\u0442, \u0447\u0442\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u043c \u044d\u0442\u043e\u0433\u043e \u043d\u0435 \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u0434\u0435\u043b\u0430\u0442\u044c.<br \/>  \u041f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430:  <\/p>\n<pre><code class=\"bash\">output {   email {     type =&gt; &quot;custom_log&quot;     from =&gt; &quot;logstash@domain.com&quot;     to =&gt; &quot;admin1@domain.com&quot;     cc =&gt; &quot;admin2@domain.com&quot;     subject =&gt; &quot;Found '%{matchName}' Alert on %{@source_host}&quot;     body =&gt; &quot;Here is the event line %{@message}&quot;     htmlbody =&gt; &quot;&lt;h2&gt;%{matchName}&lt;\/h2&gt;&lt;br\/&gt;&lt;br\/&gt;&lt;h3&gt;Full Event&lt;\/h3&gt;&lt;br\/&gt;&lt;br\/&gt;&lt;div align='center'&gt;%{@message}&lt;\/div&gt;&quot;     via =&gt; &quot;sendmail&quot;     options =&gt; [ &quot;smtpIporHost&quot;, &quot;smtp.gmail.com&quot;,                           &quot;port&quot;, &quot;587&quot;,                           &quot;domain&quot;, &quot;yourDomain&quot;,                           &quot;userName&quot;, &quot;yourSMTPUsername&quot;,                           &quot;password&quot;, &quot;PASS&quot;,                           &quot;starttls&quot;, &quot;true&quot;,                           &quot;authenticationType&quot;, &quot;plain&quot;,                           &quot;debug&quot;, &quot;true&quot;                          ]     match =&gt; [ &quot;response errors&quot;, &quot;response,501,,or,response,301&quot;,                         &quot;multiple response errors&quot;, &quot;response,501,,and,response,301&quot; ]    } } <\/code><\/pre>\n<pre><code class=\"bash\">type =&gt; &quot;custom_log&quot; <\/code><\/pre>\n<p>\u0442\u0438\u043f\/\u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043b\u043e\u0433\u0430.<\/p>\n<pre><code class=\"bash\">from =&gt; &quot;logstash@domain.com&quot; to =&gt; &quot;admin1@domain.com&quot; cc =&gt; &quot;admin2@domain.com&quot; <\/code><\/pre>\n<p>\u0435\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0445\u0432\u0430\u0442\u0438\u043b\u043e \u0441\u0438\u043b \u0434\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0434\u043e \u044d\u0442\u0438\u0445 \u0441\u0442\u0440\u043e\u043a, \u0437\u043d\u0430\u0447\u0438\u0442 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u0430\u043c\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0441\u043c\u044b\u0441\u043b \u044d\u0442\u0438\u0445 3\u0445 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a \ud83d\ude42<\/p>\n<pre><code class=\"bash\">subject =&gt; &quot;Found '%{matchName}' Alert on %{@source_host}&quot; <\/code><\/pre>\n<p>\u0442\u0435\u043c\u0430 \u043f\u0438\u0441\u044c\u043c\u0430 \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u044f. \u041c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 %{matchName} \u2014 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u044f \u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u044f \u0438\u0437 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u00abmatch\u00bb.<\/p>\n<pre><code class=\"bash\">body =&gt; &quot;Here is the event line %{@message}&quot; htmlbody =&gt; &quot;&lt;h2&gt;%{matchName}&lt;\/h2&gt;&lt;br\/&gt;&lt;br\/&gt;&lt;h3&gt;Full Event&lt;\/h3&gt;&lt;br\/&gt;&lt;br\/&gt;&lt;div align='center'&gt;%{@message}&lt;\/div&gt;&quot; <\/code><\/pre>\n<p>\u0442\u0435\u043b\u043e \u043f\u0438\u0441\u044c\u043c\u0430. <\/p>\n<pre><code class=\"bash\">via =&gt; &quot;sendmail&quot; <\/code><\/pre>\n<p>\u0441\u043f\u043e\u0441\u043e\u0431 \u043e\u0442\u0441\u044b\u043b\u043a\u0438 \u043f\u0438\u0441\u044c\u043c\u0430. \u0412\u043e\u0437\u043c\u043e\u0436\u0435\u043d \u043e\u0434\u0438\u043d \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0438\u0437 \u0434\u0432\u0443\u0445 \u2014 smtp \u0438\u043b\u0438 sendmail.<\/p>\n<pre><code class=\"bash\">options =&gt; ... <\/code><\/pre>\n<p>\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043f\u043e\u0447\u0442\u043e\u0432\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432.<\/p>\n<pre><code class=\"bash\">match =&gt; [ &quot;response errors&quot;, &quot;response,501,,or,response,301&quot;,                     &quot;multiple response errors&quot;, &quot;response,501,,and,response,301&quot; ] <\/code><\/pre>\n<p>\u00abresponse errors\u00bb \u2014 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0430\u043b\u0435\u0440\u0442\u0430 (\u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e %{matchName}). \u00abresponse,501,,or,response,301\u00bb \u2014 \u043a\u0440\u0438\u0442\u0435\u0440\u0438\u0438 \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043d\u0438\u044f \u0430\u043b\u0435\u0440\u0442\u043e\u0432. \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0435\u0441\u043b\u0438 \u043f\u043e\u043b\u0435 response \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 501 \u0438\u043b\u0438 301, \u0442\u043e \u0430\u043b\u0435\u0440\u0442 \u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u0432\u0448\u0438\u043c. \u0412\u043e \u0432\u0442\u043e\u0440\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043b\u043e\u0433\u0438\u043a\u0430 AND, \u0442.\u0435. \u043e\u0431\u0430 \u0443\u0441\u043b\u043e\u0432\u0438\u044f \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u044b.<\/p><\/div>\n<\/div>\n<h4>4. \u0418\u0442\u043e\u0433\u043e<\/h4>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0451\u043c \u0444\u0430\u0439\u043b habr.conf:  <\/p>\n<pre><code class=\"bash\">input {   tcp {     type =&gt; &quot;habr&quot;     port =&gt; &quot;11111&quot;   } } filter {   mutate {     type =&gt; &quot;habr&quot;     add_field =&gt; [ &quot;habra_field&quot;, &quot;Hello Habr&quot; ]   } } output {   stdout {     type =&gt; &quot;habr&quot;     message =&gt; &quot;%{habra_field}: %{@message}&quot;   } } <\/code><\/pre>\n<p>  \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c Logstash:<br \/>  <code>java -jar logstash-1.1.9-monolithic.jar agent -f .\/habr.conf<\/code><\/p>\n<p>  \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0447\u0442\u043e Logstash \u0437\u0430\u043f\u0443\u0449\u0435\u043d:<br \/>  # netstat -nat |grep 11111<br \/>  \u0415\u0441\u043b\u0438 \u043f\u043e\u0440\u0442 11111 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442, \u0437\u043d\u0430\u0447\u0438\u0442 Logstash \u0433\u043e\u0442\u043e\u0432 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u043b\u043e\u0433\u0438.<\/p>\n<p>  \u0412 \u043d\u043e\u0432\u043e\u043c \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u043c \u043e\u043a\u043d\u0435 \u043f\u0438\u0448\u0435\u043c:<br \/>  <code>echo &quot;Logs are cool!&quot; | nc localhost 11111<\/code><\/p>\n<p>  \u0421\u043c\u043e\u0442\u0440\u0438\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432 \u043e\u043a\u043d\u0435 \u0433\u0434\u0435 \u0437\u0430\u043f\u0443\u0449\u0435\u043d Logstash. \u0415\u0441\u043b\u0438 \u0442\u0430\u043c \u043f\u043e\u044f\u0432\u0438\u043b\u043e\u0441\u044c \u0441\u0435\u043a\u0440\u0435\u0442\u043d\u043e\u0435 \u043f\u043e\u0441\u043b\u0430\u043d\u0438\u0435, \u0437\u043d\u0430\u0447\u0438\u0442 \u0432\u0441\u0451 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. <\/p>\n<p>  P.s.\u041f\u043e\u0441\u043b\u0435\u0434\u043d\u044e\u044e \u0432\u0435\u0440\u0441\u0438\u044e Logstash \u043c\u043e\u0436\u043d\u043e \u0441\u043a\u0430\u0447\u0430\u0442\u044c <a href=\"http:\/\/logstash.net\">\u043e\u0442\u0441\u044e\u0434\u0430<\/a>.<\/p>\n<p>  \u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435,    \t \t\t   \t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/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=\"http:\/\/habrahabr.ru\/post\/165059\/\"> http:\/\/habrahabr.ru\/post\/165059\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">   \t\u041f\u0440\u0438\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e.<\/p>\n<p>  \u0422\u0430\u043a \u0443\u0436 \u0441\u043b\u043e\u0436\u0438\u043b\u043e\u0441\u044c, \u0447\u0442\u043e \u043f\u043e \u0434\u043e\u043b\u0433\u0443 \u0440\u0430\u0431\u043e\u0442\u044b \u043c\u043d\u0435 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0443\u0434\u0435\u043b\u044f\u0442\u044c \u043b\u043e\u0433\u0430\u043c. \u042d\u0442\u043e \u0438 \u0443\u0447\u0430\u0441\u0442\u0438\u0435 \u0432 \u0432\u044b\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u043f\u0440\u0430\u0432\u0438\u043b \u0438 \u043f\u043e\u043b\u0438\u0442\u0438\u043a \u0441\u0431\u043e\u0440\u0430\/\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f\/\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043b\u043e\u0433\u043e\u0432, \u044d\u0442\u043e \u0438 \u0440\u0430\u0437\u0431\u043e\u0440 \u0440\u0430\u0437\u043d\u044b\u0445 \u0438\u043d\u0446\u0438\u0434\u0435\u043d\u0442\u043e\u0432 \u0438 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u0435 \u0430\u043d\u043e\u043c\u0430\u043b\u0438\u0439. \u0417\u0430 \u0441\u0443\u0442\u043a\u0438 \u043d\u0430\u0448\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b, \u0441\u0435\u0440\u0432\u0438\u0441\u044b \u0438 \u0441\u0435\u0440\u0432\u0435\u0440\u044b \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u044e\u0442 \u041e\u0427\u0415\u041d\u042c \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043b\u043e\u0433\u043e\u0432. \u0418 \u043f\u043e\u0442\u0440\u0435\u0431\u043d\u043e\u0441\u0442\u044c \u043a\u043e\u043f\u0430\u043d\u0438\u044f \u0432 \u043b\u043e\u0433\u0430\u0445 \u0440\u0430\u0441\u0442\u0451\u0442 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e.<br \/>  \u041c\u043d\u0435 \u0434\u043e\u0432\u0435\u043b\u043e\u0441\u044c \u043f\u043e\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043a\u043e\u043c\u043c\u0435\u0440\u0447\u0435\u0441\u043a\u0438\u043c\u0438 \u043b\u043e\u0433-\u043c\u0435\u043d\u0435\u0434\u0436\u043c\u0435\u043d\u0442 \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u0430\u043c\u0438 \u0442\u0438\u043f\u0430 ArcSight, RSA Envision, Q1 Labs. \u0423 \u044d\u0442\u0438\u0445 \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u043e\u0432 \u0435\u0441\u0442\u044c \u043a\u0430\u043a \u043f\u043b\u044e\u0441\u044b, \u0442\u0430\u043a \u0438 \u043c\u0438\u043d\u0443\u0441\u044b. \u041d\u043e \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 \u0440\u0435\u0447\u044c \u043f\u043e\u0439\u0434\u0451\u0442 \u043d\u0435 \u043e \u043d\u0438\u0445. <br \/>  \u0420\u0435\u0447\u044c \u0431\u0443\u0434\u0435\u0442 \u043e <a href=\"http:\/\/www.logstash.net\/\">Logstash<\/a>.<\/p>\n<p>  \u0427\u0442\u043e \u0436\u0435 \u0442\u0430\u043a\u043e\u0435 Logstash? \u0417\u0430\u0447\u0435\u043c \u043e\u043d \u043d\u0443\u0436\u0435\u043d? \u0427\u0442\u043e \u043e\u043d \u0443\u043c\u0435\u0435\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-165059","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/165059","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=165059"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/165059\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=165059"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=165059"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=165059"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}