{"id":3252,"date":"2018-11-07T08:02:19","date_gmt":"2018-11-07T08:02:19","guid":{"rendered":"https:\/\/tst-amo.net.ua\/blog\/?p=3252"},"modified":"2018-11-07T08:07:24","modified_gmt":"2018-11-07T08:07:24","slug":"rsyslog","status":"publish","type":"post","link":"https:\/\/tst-amo.net.ua\/blog\/?p=3252","title":{"rendered":"rsyslog"},"content":{"rendered":"<p>\u0415\u0441\u043b\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0435\u0441\u044b\u043b\u0430\u044e\u0442\u0441\u044f \u043c\u0435\u0436\u0434\u0443 \u0445\u043e\u0441\u0442\u0430\u043c\u0438, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u043c\u0438 rsyslog, \u043c\u043e\u0436\u043d\u043e \u0432\u043c\u0435\u0441\u0442\u043e plain TCP sysog \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u00a0<a href=\"http:\/\/www.rsyslog.com\/doc\/relp.html\">RELP<\/a>\u00a0\u2014 Reliable Event Logging Protocol. \u0411\u044b\u043b \u0441\u043e\u0437\u0434\u0430\u043d \u0434\u043b\u044f rsyslog, \u0441\u0435\u0439\u0447\u0430\u0441 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0438 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u043c\u0438. \u0412 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438, \u0435\u0433\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u044e\u0442 Logstash \u0438 Graylog. \u0414\u043b\u044f \u0442\u0440\u0430\u043d\u0441\u043f\u043e\u0440\u0442\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 TCP. \u041c\u043e\u0436\u0435\u0442 \u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e \u0448\u0438\u0444\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e TLS. \u041d\u0430\u0434\u0451\u0436\u043d\u0435\u0435 plain TCP syslog, \u043d\u0435 \u0442\u0435\u0440\u044f\u0435\u0442 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043f\u0440\u0438 \u0440\u0430\u0437\u0440\u044b\u0432\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f. \u0420\u0435\u0448\u0430\u0435\u0442 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u0441 \u043c\u043d\u043e\u0433\u043e\u0441\u0442\u0440\u043e\u0447\u043d\u044b\u043c\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f\u043c\u0438.<\/p>\n<h4 id=\"konfiguraciya-rsyslog\">\u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f rsyslog<\/h4>\n<p>\u0412 \u043e\u0442\u043b\u0438\u0447\u0438\u0438 \u043e\u0442 \u0432\u0442\u043e\u0440\u043e\u0439 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0451\u043d\u043d\u043e\u0439 \u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u044b, syslog-ng, rsyslog \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c \u0441 \u043a\u043e\u043d\u0444\u0438\u0433\u0430\u043c\u0438 \u0438\u0441\u0442\u043e\u0440\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e syslogd:<\/p>\n<pre><code class=\"bash hljs\">auth,authpriv.*            \/var\/<span class=\"hljs-built_in\">log<\/span>\/auth.log\r\n*.*;auth,authpriv.none     \/var\/<span class=\"hljs-built_in\">log<\/span>\/syslog\r\n*.*       @syslog.example.net<\/code><\/pre>\n<p>\u0422. \u043a. \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 rsyslog \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u0431\u043e\u043b\u044c\u0448\u0435, \u0447\u0435\u043c \u0443 \u0435\u0433\u043e \u043f\u0440\u0435\u0434\u0448\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u0438\u043a\u0430, \u0444\u043e\u0440\u043c\u0430\u0442 \u043a\u043e\u043d\u0444\u0438\u0433\u043e\u0432 \u0431\u044b\u043b \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u0430\u043c\u0438, \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0438\u043c\u0438\u0441\u044f \u0441\u043e \u0437\u043d\u0430\u043a\u0430\u00a0<code>$<\/code>:<\/p>\n<pre><code class=\"bash hljs\"><span class=\"hljs-variable\">$ActionFileDefaultTemplate<\/span> RSYSLOG_TraditionalFileFormat\r\n<span class=\"hljs-variable\">$WorkDirectory<\/span> \/var\/spool\/rsyslog\r\n<span class=\"hljs-variable\">$IncludeConfig<\/span> \/etc\/rsyslog.d\/*.conf<\/code><\/pre>\n<p>\u041d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 \u0448\u0435\u0441\u0442\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438, \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f \u0441\u0438-\u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0439 \u0444\u043e\u0440\u043c\u0430\u0442 RainerScript, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0439 \u0437\u0430\u0434\u0430\u0432\u0430\u0442\u044c \u0441\u043b\u043e\u0436\u043d\u044b\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439.<\/p>\n<p>\u0422. \u043a. \u0432\u0441\u0451 \u044d\u0442\u043e \u0434\u0435\u043b\u0430\u043b\u043e\u0441\u044c \u043f\u043e\u0441\u0442\u0435\u043f\u0435\u043d\u043d\u043e \u0438 \u0441 \u0443\u0447\u0451\u0442\u043e\u043c \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u043e\u0441\u0442\u0438 \u0441\u043e \u0441\u0442\u0430\u0440\u044b\u043c\u0438 \u043a\u043e\u043d\u0444\u0438\u0433\u0430\u043c\u0438, \u0442\u043e \u0432 \u0438\u0442\u043e\u0433\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0430\u0441\u044c \u043f\u0430\u0440\u0430 \u043d\u0435\u043f\u0440\u0438\u044f\u0442\u043d\u044b\u0445 \u043c\u043e\u043c\u0435\u043d\u0442\u043e\u0432:<\/p>\n<ul>\n<li>\u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043b\u0430\u0433\u0438\u043d\u044b(\u044f \u043f\u043e\u043a\u0430 \u0441 \u0442\u0430\u043a\u0438\u043c\u0438 \u043d\u0435 \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u043b\u0441\u044f) \u043c\u043e\u0433\u0443\u0442 \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0439 RainerScript \u0441\u0442\u0438\u043b\u044c \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a, \u0438\u043c \u043f\u043e-\u043f\u0440\u0435\u0436\u043d\u0435\u043c\u0443 \u043d\u0443\u0436\u043d\u044b \u0441\u0442\u0430\u0440\u044b\u0435 \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u044b<\/li>\n<li>\u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0447\u0435\u0440\u0435\u0437 \u0441\u0442\u0430\u0440\u044b\u0435 \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u044b \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043a\u0430\u043a \u043e\u0436\u0438\u0434\u0430\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043d\u043e\u0432\u043e\u0433\u043e \u0444\u043e\u0440\u043c\u0430\u0442\u0430:\n<ul>\n<li>\u0435\u0441\u043b\u0438 \u043c\u043e\u0434\u0443\u043b\u044c\u00a0<code>omfile<\/code>\u00a0\u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u0442\u0430\u0440\u043e\u0433\u043e \u0444\u043e\u0440\u043c\u0430\u0442\u0430:<br \/>\n<code>auth,authpriv.* \/var\/log\/auth.log<\/code>, \u0442\u043e \u0432\u043b\u0430\u0434\u0435\u043b\u0435\u0446 \u0438 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u0432\u0448\u0435\u0433\u043e\u0441\u044f \u0444\u0430\u0439\u043b\u0430 \u0440\u0435\u0433\u0443\u043b\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0441\u0442\u0430\u0440\u044b\u043c\u0438 \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u0430\u043c\u0438\u00a0<code>$FileOwner<\/code>,\u00a0<code>$FileGroup<\/code>,\u00a0<code>$FileCreateMode<\/code>. \u0410 \u0432\u043e\u0442 \u0435\u0441\u043b\u0438 \u043e\u043d \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e\u00a0<code>action(type=\"omfile\" ...)<\/code>, \u0442\u043e \u044d\u0442\u0438 \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u044b \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u0443\u044e\u0442\u0441\u044f, \u0438 \u043d\u0430\u0434\u043e \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u044b action \u0438\u043b\u0438 \u0437\u0430\u0434\u0430\u0432\u0430\u0442\u044c \u043f\u0440\u0438 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0435 \u043c\u043e\u0434\u0443\u043b\u044f<\/li>\n<li>\u0414\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u044b \u0432\u0438\u0434\u0430\u00a0<code>$ActionQueueXXX<\/code>\u00a0\u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u044e\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u0443 \u043e\u0447\u0435\u0440\u0435\u0434\u044c, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0430 \u0432 \u043f\u0435\u0440\u0432\u043e\u043c action \u043f\u043e\u0441\u043b\u0435 \u043d\u0438\u0445, \u043f\u043e\u0442\u043e\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0441\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u044e\u0442\u0441\u044f.<\/li>\n<\/ul>\n<\/li>\n<li>\u0442\u043e\u0447\u043a\u0438 \u0441 \u0437\u0430\u043f\u044f\u0442\u043e\u0439 \u0433\u0434\u0435-\u0442\u043e \u0437\u0430\u043f\u0440\u0435\u0449\u0435\u043d\u044b, \u0430 \u0433\u0434\u0435-\u0442\u043e \u043d\u0430\u043e\u0431\u043e\u0440\u043e\u0442 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b(\u0432\u0442\u043e\u0440\u043e\u0435 \u0440\u0435\u0436\u0435)<\/li>\n<\/ul>\n<p>\u0427\u0442\u043e\u0431\u044b \u043d\u0435 \u0441\u043f\u043e\u0442\u044b\u043a\u0430\u0442\u044c\u0441\u044f \u043e\u0431 \u044d\u0442\u0438 \u0442\u043e\u043d\u043a\u043e\u0441\u0442\u0438(\u0434\u0430, \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043e\u043d\u0438 \u043e\u043f\u0438\u0441\u0430\u043d\u044b, \u043d\u043e \u043a\u0442\u043e \u0436\u0435 \u0435\u0451 \u0446\u0435\u043b\u0438\u043a\u043e\u043c \u0447\u0438\u0442\u0430\u0435\u0442?), \u0441\u0442\u043e\u0438\u0442 \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u043f\u0440\u0430\u0432\u0438\u043b\u0430\u043c:<\/p>\n<ul>\n<li>\u0434\u043b\u044f \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0445 \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u043a\u043e\u043d\u0444\u0438\u0433\u043e\u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0442\u0430\u0440\u044b\u0439 \u0444\u043e\u0440\u043c\u0430\u0442:<br \/>\n<code>:programname, startswith, \"haproxy\" \/var\/log\/haproxy.log<\/code><\/li>\n<li>\u0434\u043b\u044f \u0441\u043b\u043e\u0436\u043d\u043e\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u0438 \u0434\u043b\u044f \u0442\u043e\u043d\u043a\u043e\u0439 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 Actions \u0432\u0441\u0435\u0433\u0434\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c RainerScript, \u043d\u0435 \u0442\u0440\u043e\u0433\u0430\u044f legacy \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u044b \u0432\u0438\u0434\u0430\u00a0<code>$DoSomething<\/code><\/li>\n<\/ul>\n<p>\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043f\u0440\u043e \u0444\u043e\u0440\u043c\u0430\u0442 \u043a\u043e\u043d\u0444\u0438\u0433\u0430\u00a0<a href=\"http:\/\/www.rsyslog.com\/doc\/v8-stable\/configuration\/basic_structure.html#configuration-file\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<h4 id=\"obrabotka-soobscheniy\">\u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439<\/h4>\n<ul>\n<li>\u0412\u0441\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043f\u0440\u0438\u0445\u043e\u0434\u044f\u0442 \u0438\u0437 Input(\u0438\u0445 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043c\u043d\u043e\u0433\u043e) \u0438 \u043f\u043e\u043f\u0430\u0434\u0430\u044e\u0442 \u043d\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0432 \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0439 \u043a \u043d\u0435\u043c\u0443 RuleSet. \u0415\u0441\u043b\u0438 \u044d\u0442\u043e \u044f\u0432\u043d\u043e \u043d\u0435 \u0437\u0430\u0434\u0430\u043d\u043e, \u0442\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043f\u043e\u043f\u0430\u0434\u0443\u0442 \u0432 RuleSet \u043f\u043e-\u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e. \u0412\u0441\u0435 \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u044b \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439, \u043d\u0435 \u0432\u044b\u043d\u0435\u0441\u0435\u043d\u043d\u044b\u0435 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 RuleSet-\u0431\u043b\u043e\u043a\u0438, \u043e\u0442\u043d\u043e\u0441\u044f\u0442\u0441\u044f \u0438\u043c\u0435\u043d\u043d\u043e \u043a \u043d\u0435\u043c\u0443. \u0412 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438, \u043a \u043d\u0435\u043c\u0443 \u043e\u0442\u043d\u043e\u0441\u044f\u0442\u0441\u044f \u0432\u0441\u0435 \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u044b \u0438\u0437 \u0442\u0440\u0430\u0434\u0438\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u0444\u043e\u0440\u043c\u0430\u0442\u0430 \u043a\u043e\u043d\u0444\u0438\u0433\u043e\u0432:<br \/>\n<code>local7.* \/var\/log\/myapp\/my.log<\/code><\/li>\n<li>\u043a Input \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043d \u0441\u043f\u0438\u0441\u043e\u043a \u043f\u0430\u0440\u0441\u0435\u0440\u043e\u0432 \u0434\u043b\u044f \u0440\u0430\u0437\u0431\u043e\u0440\u0430 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f. \u0415\u0441\u043b\u0438 \u044f\u0432\u043d\u043e \u043d\u0435 \u0437\u0430\u0434\u0430\u043d\u043e, \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0441\u043f\u0438\u0441\u043e\u043a \u043f\u0430\u0440\u0441\u0435\u0440\u043e\u0432 \u0434\u043b\u044f \u0440\u0430\u0437\u0431\u043e\u0440\u0430 \u0442\u0440\u0430\u0434\u0438\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u0444\u043e\u0440\u043c\u0430\u0442\u0430 syslog<\/li>\n<li>\u041f\u0430\u0440\u0441\u0435\u0440 \u0432\u044b\u0434\u0435\u043b\u044f\u0435\u0442 \u0438\u0437 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430. \u0421\u0430\u043c\u044b\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0435:\n<ul>\n<li><code>$msg<\/code>\u00a0\u2014 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435<\/li>\n<li><code>$rawmsg<\/code>\u00a0\u2014 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0446\u0435\u043b\u0438\u043a\u043e\u043c \u0434\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043f\u0430\u0440\u0441\u0435\u0440\u043e\u043c<\/li>\n<li><code>$fromhost<\/code>,\u00a0<code>$fromhost-ip<\/code>\u00a0\u2014 DNS \u0438\u043c\u044f \u0438 IP \u0430\u0434\u0440\u0435\u0441 \u0445\u043e\u0441\u0442\u0430-\u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u0435\u043b\u044f<\/li>\n<li><code>$syslogfacility<\/code>,\u00a0<code>$syslogfacility-text<\/code>\u00a0\u2014 facility \u0432 \u0447\u0438\u0441\u043b\u043e\u0432\u043e\u0439 \u0438 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u0439 \u0444\u043e\u0440\u043c\u0435<\/li>\n<li><code>$syslogseverity<\/code>,\u00a0<code>$syslogseverity-text<\/code>\u00a0\u2014 \u0442\u043e \u0436\u0435 \u0434\u043b\u044f severity<\/li>\n<li><code>$timereported<\/code>\u00a0\u2014 \u0432\u0440\u0435\u043c\u044f \u0438\u0437 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f<\/li>\n<li><code>$syslogtag<\/code>\u00a0\u2014 \u043f\u043e\u043b\u0435 TAG<\/li>\n<li><code>$programname<\/code>\u00a0\u2014 \u043f\u043e\u043b\u0435 TAG \u0441 \u043e\u0442\u0440\u0435\u0437\u0430\u043d\u043d\u044b\u043c id \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430:\u00a0<code>named[12345]<\/code>\u00a0-&gt;\u00a0<code>named<\/code><\/li>\n<li>\u0432\u0435\u0441\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c\u00a0<a href=\"http:\/\/www.rsyslog.com\/doc\/v8-stable\/configuration\/properties.html\">\u0442\u0443\u0442<\/a><\/li>\n<\/ul>\n<\/li>\n<li>RuleSet \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u043f\u0440\u0430\u0432\u0438\u043b, \u043f\u0440\u0430\u0432\u0438\u043b\u043e \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u0444\u0438\u043b\u044c\u0442\u0440\u0430 \u0438 \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u043a \u043d\u0435\u043c\u0443 \u043e\u0434\u043d\u043e\u0433\u043e \u0438\u043b\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 Actions<\/li>\n<li>\u0424\u0438\u043b\u044c\u0442\u0440\u044b \u2014 \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f, \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0441\u0432\u043e\u0439\u0441\u0442\u0432 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f.\u00a0<a href=\"http:\/\/www.rsyslog.com\/doc\/v8-stable\/configuration\/filters.html\">\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043f\u0440\u043e \u0444\u0438\u043b\u044c\u0442\u0440\u044b<\/a><\/li>\n<li>\u041f\u0440\u0430\u0432\u0438\u043b\u0430 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043a \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044e, \u043f\u043e\u043f\u0430\u0432\u0448\u0435\u043c\u0443 \u0432 RuleSet, \u043d\u0430 \u043f\u0435\u0440\u0432\u043e\u043c \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u0432\u0448\u0435\u043c \u043f\u0440\u0430\u0432\u0438\u043b\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043d\u0435 \u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f<\/li>\n<li>\u0427\u0442\u043e\u0431\u044b \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f, \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0435 discard action:\u00a0<code>stop<\/code>\u00a0\u0438\u043b\u0438\u00a0<code>~<\/code>\u00a0\u0432 \u043b\u0435\u0433\u0430\u0441\u0438-\u0444\u043e\u0440\u043c\u0430\u0442\u0435.<\/li>\n<li>\u0412\u043d\u0443\u0442\u0440\u0438 Action \u0447\u0430\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0448\u0430\u0431\u043b\u043e\u043d\u044b. \u0428\u0430\u0431\u043b\u043e\u043d\u044b \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0432 Action \u0438\u0437 \u0441\u0432\u043e\u0439\u0441\u0442\u0432 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0444\u043e\u0440\u043c\u0430\u0442 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u043f\u043e \u0441\u0435\u0442\u0438 \u0438\u043b\u0438 \u0438\u043c\u044f \u0444\u0430\u0439\u043b\u0430 \u0434\u043b\u044f \u0437\u0430\u043f\u0438\u0441\u0438.\u00a0<a href=\"http:\/\/www.rsyslog.com\/doc\/v8-stable\/configuration\/templates.html\">\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043f\u0440\u043e \u0448\u0430\u0431\u043b\u043e\u043d\u044b<\/a><\/li>\n<li>\u041a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e, Action \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043c\u043e\u0434\u0443\u043b\u044c \u0432\u044b\u0432\u043e\u0434\u0430(&#8220;om&#8230;&#8221;) \u0438\u043b\u0438 \u043c\u043e\u0434\u0443\u043b\u044c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f(&#8220;mm&#8230;&#8221;). \u0412\u043e\u0442 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0437 \u043d\u0438\u0445:\n<ul>\n<li><a href=\"http:\/\/www.rsyslog.com\/doc\/v8-stable\/configuration\/modules\/omfile.html\">omfile<\/a>\u00a0\u2014 \u0432\u044b\u0432\u043e\u0434 \u0432 \u0444\u0430\u0439\u043b<\/li>\n<li><a href=\"http:\/\/www.rsyslog.com\/doc\/v8-stable\/configuration\/modules\/omfwd.html\">omfwd<\/a>\u00a0\u2014 \u043f\u0435\u0440\u0435\u0441\u044b\u043b\u043a\u0430 \u043f\u043e \u0441\u0435\u0442\u0438, \u0447\u0435\u0440\u0435\u0437 udp \u0438\u043b\u0438 tcp<\/li>\n<li><a href=\"http:\/\/www.rsyslog.com\/doc\/v8-stable\/configuration\/modules\/omrelp.html\">omrelp<\/a>\u00a0\u2014 \u043f\u0435\u0440\u0435\u0441\u044b\u043b\u043a\u0430 \u043f\u043e \u0441\u0435\u0442\u0438 \u043f\u043e \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0443 RELP<\/li>\n<li><a href=\"http:\/\/www.rsyslog.com\/doc\/v8-stable\/configuration\/modules\/ommysql.html\">onmysql<\/a>,\u00a0<a href=\"http:\/\/www.rsyslog.com\/doc\/v8-stable\/configuration\/modules\/ompgsql.html\">ompgsql<\/a>,\u00a0<a href=\"http:\/\/www.rsyslog.com\/doc\/v8-stable\/configuration\/modules\/omoracle.html\">omoracle<\/a>\u00a0\u2014 \u0437\u0430\u043f\u0438\u0441\u044c \u0432 \u0431\u0430\u0437\u0443<\/li>\n<li><a href=\"http:\/\/www.rsyslog.com\/doc\/v8-stable\/configuration\/modules\/omelasticsearch.html\">omelasticsearch<\/a>\u00a0\u2014 \u0437\u0430\u043f\u0438\u0441\u044c \u0432 ElasticSearch<\/li>\n<li><a href=\"http:\/\/www.rsyslog.com\/doc\/v8-stable\/configuration\/modules\/omamqp1.html\">omamqp1<\/a>\u00a0\u2014 \u043f\u0435\u0440\u0435\u0441\u044b\u043b\u043a\u0430 \u043f\u043e \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0443 AMQP 1.0<\/li>\n<li><a href=\"http:\/\/www.rsyslog.com\/doc\/v8-stable\/configuration\/modules\/idx_output.html\">\u0432\u0435\u0441\u044c \u0441\u043f\u0438\u0441\u043e\u043a<\/a>\u00a0\u043c\u043e\u0434\u0443\u043b\u0435\u0439 \u0432\u044b\u0432\u043e\u0434\u0430<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><a href=\"http:\/\/www.rsyslog.com\/doc\/v8-stable\/configuration\/basic_structure.html#quick-overview-of-message-flow-and-objects\">\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043f\u0440\u043e \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439<\/a><\/p>\n<h4 id=\"primery-konfiguracii\">\u041f\u0440\u0438\u043c\u0435\u0440\u044b \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438<\/h4>\n<p>\u0417\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0432\u0441\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0439 auth \u0438 authpriv \u0432 \u0444\u0430\u0439\u043b\u00a0<code>\/var\/log\/auth.log<\/code>, \u0438 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u043c \u0438\u0445 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443:<\/p>\n<pre><code class=\"hljs livecodeserver\"><span class=\"hljs-comment\"># legacy<\/span>\r\nauth,authpriv.*  \/var\/<span class=\"hljs-built_in\">log<\/span>\/auth.<span class=\"hljs-built_in\">log<\/span>\r\n<span class=\"hljs-comment\"># \u043d\u043e\u0432\u044b\u0439 \u0444\u043e\u0440\u043c\u0430\u0442<\/span>\r\n<span class=\"hljs-keyword\">if<\/span> ( $syslogfacility-<span class=\"hljs-keyword\">text<\/span> == <span class=\"hljs-string\">\"auth\"<\/span> <span class=\"hljs-keyword\">or<\/span> $syslogfacility-<span class=\"hljs-keyword\">text<\/span> == <span class=\"hljs-string\">\"authpriv\"<\/span> ) <span class=\"hljs-keyword\">then<\/span> {\r\n    action(type=<span class=\"hljs-string\">\"omfile\"<\/span> <span class=\"hljs-built_in\">file<\/span>=<span class=\"hljs-string\">\"\/var\/log\/auth.log\"<\/span>)\r\n}<\/code><\/pre>\n<p>\u0412\u0441\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0441 \u0438\u043c\u0435\u043d\u0435\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b, \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0438\u043c\u0441\u044f \u0441 &#8220;haproxy&#8221;, \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0432 \u0444\u0430\u0439\u043b\u00a0<code>\/var\/log\/haproxy.log<\/code>, \u043d\u0435 \u0441\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u044f \u0431\u0443\u0444\u0435\u0440 \u043d\u0430 \u0434\u0438\u0441\u043a \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f, \u0438 \u043f\u0440\u0435\u043a\u0440\u0430\u0449\u0430\u0435\u043c \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0443\u044e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443:<\/p>\n<pre><code class=\"hljs livecodeserver\"><span class=\"hljs-comment\"># legacy (\u043e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u043c\u0438\u043d\u0443\u0441 \u043f\u0435\u0440\u0435\u0434 \u0438\u043c\u0435\u043d\u0435\u043c \u0444\u0430\u0439\u043b\u0430, \u043e\u0442\u043a\u043b\u044e\u0447\u0430\u044e\u0449\u0438\u0439 \u0441\u0431\u0440\u043e\u0441 \u0431\u0443\u0444\u0435\u0440\u0430)<\/span>\r\n:programname, startswith, <span class=\"hljs-string\">\"haproxy\"<\/span>, -\/var\/<span class=\"hljs-built_in\">log<\/span>\/haproxy.<span class=\"hljs-built_in\">log<\/span>\r\n&amp; ~\r\n<span class=\"hljs-comment\"># \u043d\u043e\u0432\u044b\u0439 \u0444\u043e\u0440\u043c\u0430\u0442<\/span>\r\n<span class=\"hljs-keyword\">if<\/span> ( $programname startswith <span class=\"hljs-string\">\"haproxy\"<\/span> ) <span class=\"hljs-keyword\">then<\/span> {\r\n    action(type=<span class=\"hljs-string\">\"omfile\"<\/span> <span class=\"hljs-built_in\">file<\/span>=<span class=\"hljs-string\">\"\/var\/log\/haproxy.log\"<\/span> flushOnTXEnd=<span class=\"hljs-string\">\"off\"<\/span>)\r\n    <span class=\"hljs-built_in\">stop<\/span>\r\n}\r\n<span class=\"hljs-comment\"># \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0432\u043c\u0435\u0449\u0430\u0442\u044c<\/span>\r\n<span class=\"hljs-keyword\">if<\/span> $programname startswith <span class=\"hljs-string\">\"haproxy\"<\/span> <span class=\"hljs-keyword\">then<\/span> -\/var\/<span class=\"hljs-built_in\">log<\/span>\/haproxy.<span class=\"hljs-built_in\">log<\/span>\r\n&amp;~<\/code><\/pre>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043a\u043e\u043d\u0444\u0438\u0433\u0430:\u00a0<code>rsyslogd -N 1<\/code>. \u0411\u043e\u043b\u044c\u0448\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438:\u00a0<a href=\"http:\/\/www.rsyslog.com\/doc\/v8-stable\/configuration\/examples.html\">site.<\/a><\/p>\n<p><a href=\"https:\/\/habr.com\/post\/321262\/\">\u0418\u0441\u0442\u043e\u0447\u043d\u0438\u043a<\/a><\/p>\n<div class=\"pdfprnt-buttons pdfprnt-buttons-post pdfprnt-bottom-right\"><a href=\"https:\/\/tst-amo.net.ua\/blog\/index.php?rest_route=wpv2posts3252&print=pdf\" class=\"pdfprnt-button pdfprnt-button-pdf\" target=\"_blank\"><img decoding=\"async\" src=\"https:\/\/tst-amo.net.ua\/blog\/wp-content\/plugins\/pdf-print\/images\/pdf.png\" alt=\"image_pdf\" title=\"View PDF\" \/><\/a><a href=\"https:\/\/tst-amo.net.ua\/blog\/index.php?rest_route=wpv2posts3252&print=print\" class=\"pdfprnt-button pdfprnt-button-print\" target=\"_blank\"><img decoding=\"async\" src=\"https:\/\/tst-amo.net.ua\/blog\/wp-content\/plugins\/pdf-print\/images\/print.png\" alt=\"image_print\" title=\"Print Content\" \/><\/a><\/div>","protected":false},"excerpt":{"rendered":"<p>\u0415\u0441\u043b\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0435\u0441\u044b\u043b\u0430\u044e\u0442\u0441\u044f \u043c\u0435\u0436\u0434\u0443 \u0445\u043e\u0441\u0442\u0430\u043c\u0438, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u043c\u0438 rsyslog, \u043c\u043e\u0436\u043d\u043e \u0432\u043c\u0435\u0441\u0442\u043e plain TCP sysog \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u00a0RELP\u00a0\u2014 Reliable Event Logging Protocol. \u0411\u044b\u043b \u0441\u043e\u0437\u0434\u0430\u043d \u0434\u043b\u044f rsyslog, \u0441\u0435\u0439\u0447\u0430\u0441 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0438 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u043c\u0438. \u0412 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438, \u0435\u0433\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u044e\u0442 Logstash \u0438 Graylog. \u0414\u043b\u044f \u0442\u0440\u0430\u043d\u0441\u043f\u043e\u0440\u0442\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 TCP. \u041c\u043e\u0436\u0435\u0442 \u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e \u0448\u0438\u0444\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e TLS. \u041d\u0430\u0434\u0451\u0436\u043d\u0435\u0435 plain TCP syslog, \u043d\u0435 \u0442\u0435\u0440\u044f\u0435\u0442 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043f\u0440\u0438 \u0440\u0430\u0437\u0440\u044b\u0432\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f. &#8230;<\/p>\n<p><a href=\"https:\/\/tst-amo.net.ua\/blog\/?p=3252\" class=\"more-link\">Continue reading &lsquo;rsyslog&rsquo; &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[47,184],"tags":[],"class_list":["post-3252","post","type-post","status-publish","format-standard","hentry","category-linux","category-rsyslog"],"_links":{"self":[{"href":"https:\/\/tst-amo.net.ua\/blog\/index.php?rest_route=\/wp\/v2\/posts\/3252"}],"collection":[{"href":"https:\/\/tst-amo.net.ua\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tst-amo.net.ua\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tst-amo.net.ua\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tst-amo.net.ua\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3252"}],"version-history":[{"count":4,"href":"https:\/\/tst-amo.net.ua\/blog\/index.php?rest_route=\/wp\/v2\/posts\/3252\/revisions"}],"predecessor-version":[{"id":3257,"href":"https:\/\/tst-amo.net.ua\/blog\/index.php?rest_route=\/wp\/v2\/posts\/3252\/revisions\/3257"}],"wp:attachment":[{"href":"https:\/\/tst-amo.net.ua\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3252"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tst-amo.net.ua\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3252"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tst-amo.net.ua\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3252"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}