{"id":332978,"date":"2022-05-11T09:00:37","date_gmt":"2022-05-11T09:00:37","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=332978"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=332978","title":{"rendered":"<span>ELK Stack<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<h3>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 Squid proxy<\/h3>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c squid \u0434\u043b\u044f \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0440\u043e\u043a\u0441\u0438-\u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b:<\/p>\n<pre><code>sudo apt install squid <\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438, squid \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0444\u0430\u0439\u043b .conf \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b:<\/p>\n<pre><code>sudo nano \/etc\/squid\/squid.conf <\/code><\/pre>\n<p>\u0412 \u043e\u0442\u043a\u0440\u044b\u0442\u043e\u043c \u0444\u0430\u0439\u043b\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043d\u0430\u0436\u0438\u043c\u0430\u0435\u043c Ctrl+W \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0439\u0442\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0435 \u043c\u0435\u0441\u0442\u043e \u0438 \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u0442\u044c:<\/p>\n<pre><code>include \/etc\/squid\/conf.d\/* <\/code><\/pre>\n<p>\u0412 \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u043e\u043c \u043c\u0435\u0441\u0442\u0435 \u043d\u0438\u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0441\u0442\u0440\u043e\u0447\u043a\u0438 \u0438 \u043f\u043e\u043b\u0435 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b:<\/p>\n<pre><code>auth_param basic program \/usr\/lib\/squid3\/basic_ncsa_auth \/etc\/squid\/passwords` auth_param basic realm proxy` acl authenticated proxy_auth REQUIRED` acl localnet src  176.59.142.172 http_access allow authenticated <\/code><\/pre>\n<p>176.59.142.172 &#8212; ip \u0430\u0434\u0440\u0435\u0441 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u044b. <\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/6be\/bd4\/be6\/6bebd4be6084c4c6312ddf19abc8ecc6.jpeg\" width=\"1920\" height=\"970\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/6be\/bd4\/be6\/6bebd4be6084c4c6312ddf19abc8ecc6.jpeg\" data-blurred=\"true\"\/><figcaption><\/figcaption><\/figure>\n<h4>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 Apache<\/h4>\n<p>\u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c Apache \u0434\u043b\u044f \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u0433\u043e \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u0440\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0435 \u0438 \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e \u043f\u043e \u043f\u0430\u0440\u043e\u043b\u044e<\/p>\n<pre><code>sudo apt install apache2-utils sudo htpasswd -c \/etc\/squid\/passwords *squid_username* <\/code><\/pre>\n<h4>\u0417\u0430\u043f\u0443\u0441\u043a \u0441\u0435\u0440\u0432\u0435\u0440\u0430<\/h4>\n<p>\u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e squid \u0441\u043b\u0443\u0448\u0430\u0435\u0442 3128 \u043f\u043e\u0440\u0442<\/p>\n<pre><code>sudo systemctl start squid sudo systemctl enable squid sudo ufw allow 3128 <\/code><\/pre>\n<p>\u0412\u0438\u0434\u0438\u043c, \u0447\u0442\u043e \u043f\u0440\u043e\u043a\u0441\u0438 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442: <\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/0ff\/697\/652\/0ff69765263587cc32c2cf6234730433.jpeg\" width=\"1541\" height=\"539\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/0ff\/697\/652\/0ff69765263587cc32c2cf6234730433.jpeg\" data-blurred=\"true\"\/><figcaption><\/figcaption><\/figure>\n<h3>Elasticsearch<\/h3>\n<h4>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 Java<\/h4>\n<p>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c Java \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u043a\u043e\u043c\u0430\u043d\u0434:<\/p>\n<pre><code>sudo apt update sudo apt install default-jre sudo apt install default-jdk <\/code><\/pre>\n<h4>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 Elasticsearch<\/h4>\n<p>Elasticsearch \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f, \u0430\u043d\u0430\u043b\u0438\u0437\u0430, \u043f\u043e\u0438\u0441\u043a\u0430 \u043f\u043e \u043b\u043e\u0433\u0430\u043c.<br \/> \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c cURL, \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e URL, \u0434\u043b\u044f \u0438\u043c\u043f\u043e\u0440\u0442\u0430 \u043e\u0442\u043a\u0440\u044b\u0442\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430 Elasticsearch GPG \u0432 APT. \u0422\u0430\u043a \u0436\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b -fsSL \u0434\u043b\u044f \u043f\u043e\u0434\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0432\u0441\u0435\u0445 \u0442\u0435\u043a\u0443\u0449\u0438\u0445 \u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u043e\u0448\u0438\u0431\u043e\u043a (\u043a\u0440\u043e\u043c\u0435 \u0441\u0431\u043e\u044f \u0441\u0435\u0440\u0432\u0435\u0440\u0430), \u0430 \u0442\u0430\u043a\u0436\u0435, \u0447\u0442\u043e\u0431\u044b \u0440\u0430\u0437\u0440\u0435\u0448\u0438\u0442\u044c cURL \u043f\u043e\u0434\u0430\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0434\u0440\u0443\u0433\u043e\u0439 \u043b\u043e\u043a\u0430\u0446\u0438\u0438 \u043f\u0440\u0438 \u043f\u0435\u0440\u0435\u0430\u0434\u0440\u0435\u0441\u0430\u0446\u0438\u0438. \u0412\u044b\u0432\u043e\u0434\u0438\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043a\u043e\u043c\u0430\u043d\u0434\u044b cURL \u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 apt-key, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0434\u043e\u0431\u0430\u0432\u0438\u0442 \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0439 \u043a\u043b\u044e\u0447 GPG \u0432 APT<\/p>\n<pre><code>curl -fsSL https:\/\/artifacts.elastic.co\/GPG-KEY-elasticsearch | sudo apt-key add - <\/code><\/pre>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0441\u043f\u0438\u0441\u043e\u043a \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u0432 Elastic \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433 sources.list.d, \u0433\u0434\u0435 APT \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043a\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0435 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0438:<\/p>\n<pre><code>echo \"deb https:\/\/artifacts.elastic.co\/packages\/7.x\/apt stable main\" | sudo tee -a \/etc\/apt\/sources.list.d\/elastic-7.x.list <\/code><\/pre>\n<p>\u041e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u043c \u0441\u043f\u0438\u0441\u043e\u043a \u043f\u0430\u043a\u0435\u0442\u043e\u0432, \u0447\u0442\u043e\u0431\u044b APT \u043c\u043e\u0433 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0439 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a Elastic \u0438 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c Elasticksearch \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b:<\/p>\n<pre><code>sudo apt update sudo apt install elasticsearch <\/code><\/pre>\n<h4>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 Elasticsearch<\/h4>\n<p>\u0414\u043b\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 Elasticsearch \u043c\u044b \u043e\u0442\u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u0443\u0435\u043c \u0444\u0430\u0439\u043b\u044b \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438. \u0412 Elasticsearch \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u0442\u0440\u0438 \u0444\u0430\u0439\u043b\u0430 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438:<\/p>\n<ul>\n<li>\n<p>elasticsearch.yml \u0434\u043b\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 Elasticsearch, \u0433\u043b\u0430\u0432\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438<\/p>\n<\/li>\n<li>\n<p>jvm.options \u0434\u043b\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u044b Elasticsearch Java Virtual Machine (JVM)<\/p>\n<\/li>\n<li>\n<p>log4j2.properties \u0434\u043b\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0436\u0443\u0440\u043d\u0430\u043b\u0430 Elasticsearch<\/p>\n<\/li>\n<\/ul>\n<p>\u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0444\u0430\u0439\u043b elasticsearch.yml \u0434\u043b\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0439. \u0424\u0430\u0439\u043b elasticsearch.yml \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0434\u043b\u044f \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430, \u0443\u0437\u043b\u0430, \u043f\u0443\u0442\u0438, \u043f\u0430\u043c\u044f\u0442\u0438, \u0441\u0435\u0442\u0438, \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u0438 \u0448\u043b\u044e\u0437\u0430. \u041d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0445\u043e\u0441\u0442\u0430 \u0441\u0435\u0442\u0438.<\/p>\n<pre><code>sudo nano \/etc\/elasticsearch\/elasticsearch.yml <\/code><\/pre>\n<p>\u0414\u043b\u044f \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u0438 \u043f\u043e\u0432\u044b\u0448\u0435\u043d\u0438\u044f \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 \u043d\u0430\u0445\u043e\u0434\u0438\u043c \u0441\u0442\u0440\u043e\u043a\u0443 \u0441 \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u0435\u043c network.host \u0438 \u0443\u0431\u0438\u0440\u0430\u0435\u043c \u0441 \u043d\u0435\u0435 \u0437\u043d\u0430\u0447\u043e\u043a \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0437\u0430\u043c\u0435\u043d\u044f\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043d\u0430 0.0.0.0, \u0447\u0442\u043e\u0431\u044b \u043e\u043d\u0430 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u043b\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c: &#171;network.host: 0.0.0.0&#187;.<br \/> Elasticsearch \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442 \u043e\u0434\u043d\u043e\u0443\u0437\u043b\u043e\u0432\u043e\u0439 \u043a\u043b\u0430\u0441\u0442\u0435\u0440: discovery.type: single-node.<br \/> \u0412\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 Elasticsearch \u043d\u0430 \u0443\u0437\u043b\u0435: xpack.security.enabled: true.<\/p>\n<h4>\u0417\u0430\u043f\u0443\u0441\u043a Elasticsearch<\/h4>\n<p>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c Elasticsearch \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u043a\u043e\u043c\u0430\u043d\u0434:<\/p>\n<pre><code>sudo systemctl start elasticsearch sudo systemctl enable elasticsearch <\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/0f3\/168\/3c7\/0f31683c78ead8dc80b55ce7d2820cf3.png\" width=\"619\" height=\"364\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/0f3\/168\/3c7\/0f31683c78ead8dc80b55ce7d2820cf3.png\"\/><figcaption><\/figcaption><\/figure>\n<h4>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439<\/h4>\n<pre><code>sudo -u root \/usr\/share\/elasticsearch\/bin\/elasticsearch-setup-passwords auto <\/code><\/pre>\n<p>\u0421\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0432\u044b\u0432\u043e\u0434<\/p>\n<pre><code>Changed password for user apm_system PASSWORD apm_system = Ff7GWmJSS4X45NewBNZN  Changed password for user kibana_system PASSWORD kibana_system = OZ7w09XTeHBg3rfihAsm  Changed password for user kibana PASSWORD kibana = OZ7w09XTeHBg3rfihAsm  Changed password for user logstash_system PASSWORD logstash_system = AKtK2rmOmkAwWfL17jCh  Changed password for user beats_system PASSWORD beats_system = ymq4MVVHCdDIVBohH5l7  Changed password for user remote_monitoring_user PASSWORD remote_monitoring_user = RbkSKKbivgZOoq02plda  Changed password for user elastic PASSWORD elastic = nrRO28jYIplnaEP3JBou <\/code><\/pre>\n<h3>Kibana<\/h3>\n<h4>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 Kibana<\/h4>\n<p>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c Kibana, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u0443\u0434\u043e\u0431\u043d\u0443\u044e \u0438 \u043a\u0440\u0430\u0441\u0438\u0432\u0443\u044e web \u043f\u0430\u043d\u0435\u043b\u044c \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043b\u043e\u0433\u0430\u043c\u0438, \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b:<\/p>\n<pre><code>sudo apt install kibana <\/code><\/pre>\n<h4>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 Kibana<\/h4>\n<p>\u041e\u0442\u043a\u0440\u043e\u0435\u043c \u0444\u0430\u0439\u043b \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438:<\/p>\n<pre><code>sudo nano \/etc\/kibana\/kibana.yml <\/code><\/pre>\n<p>\u041d\u0430\u0441\u0442\u0440\u043e\u0438\u043c username \u0438 \u0443\u043a\u0430\u0436\u0435\u043c, \u0447\u0442\u043e Elasticsearch \u0434\u043e\u043b\u0436\u043d\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u0430 \u043f\u043e\u0440\u0442\u0443 9200, \u0430 Kibana \u043d\u0430 5601:<\/p>\n<pre><code>elasticsearch.username: \"kibana_system\" elasticsearch.host: \"0.0.0.0:9200\" kibana.port: 5601 <\/code><\/pre>\n<h4>\u0417\u0430\u043f\u0443\u0441\u043a Kibana<\/h4>\n<p>\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u043c Kibana \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u043a\u043e\u043c\u0430\u043d\u0434:<\/p>\n<pre><code>sudo systemctl start kibana sudo systemctl enable kibana <\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/ca7\/e24\/3a4\/ca7e243a43b9184a67c34fd052c6b362.png\" width=\"1920\" height=\"901\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/ca7\/e24\/3a4\/ca7e243a43b9184a67c34fd052c6b362.png\"\/><figcaption><\/figcaption><\/figure>\n<h4>\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u0430\u0440\u043e\u043b\u044f<\/h4>\n<pre><code>sudo -u root \/usr\/share\/kibana\/bin\/kibana-keystore create sudo -u root \/usr\/share\/kibana\/bin\/kibana-keystore add elasticsearch.password <\/code><\/pre>\n<p>\u0412\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u043f\u0430\u0440\u043e\u043b\u044c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439<\/p>\n<pre><code>Changed password for user kibana_system PASSWORD kibana_system = OZ7w09XTeHBg3rfihAsm <\/code><\/pre>\n<p>\u0417\u0430\u0445\u043e\u0434\u0438\u043c \u0432 Elasticsearch, \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0441\u0443\u043f\u0435\u0440\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/f63\/ff7\/974\/f63ff7974dedcb5bb01e7aa9776f34d8.jpeg\" width=\"1892\" height=\"878\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/f63\/ff7\/974\/f63ff7974dedcb5bb01e7aa9776f34d8.jpeg\" data-blurred=\"true\"\/><figcaption><\/figcaption><\/figure>\n<h3>Logstash<\/h3>\n<h4>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 Logstash<\/h4>\n<p>\u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c Logstash- \u0441\u0435\u0440\u0432\u0438\u0441 \u0434\u043b\u044f \u0441\u0431\u043e\u0440\u0430 \u043b\u043e\u0433\u043e\u0432 \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0438\u0445 \u0432 Elasticsearch.<\/p>\n<pre><code>sudo apt install logstash <\/code><\/pre>\n<h4>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 Logstash<\/h4>\n<p>\u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0444\u0430\u0439\u043b \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0439:<\/p>\n<pre><code>sudo nano \/etc\/logstash\/conf.d\/logstash.conf <\/code><\/pre>\n<p>\u0423\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c, \u0447\u0442\u043e \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u043c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043d\u0430 5044 \u043f\u043e\u0440\u0442, \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u0433\u0434\u0435 \u0432 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c \u0431\u0443\u0434\u0443\u0442 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u043f\u0440\u0430\u0432\u0438\u043b\u0430,  \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 Elasticsearch \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c.<\/p>\n<pre><code>input {      beats {          port => 5044      } }  filter {   **\u041c\u0435\u0441\u0442\u043e \u0434\u043b\u044f \u043f\u0440\u0430\u0432\u0438\u043b Grok** }  output {   elasticsearch {     hosts => [\"139.59.247.231:9200\"]     manage_template => false      index => \"%{[@metadata][beat]}-%{[@metadata[version]}-%{+YYYY.MM.dd}\"     user => \"user\"     password => \"password\"   } }  <\/code><\/pre>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441, \u0447\u0442\u043e\u0431\u044b \u0432 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c \u043d\u0435 \u043f\u043e\u044f\u0432\u0438\u043b\u0438\u0441\u044c \u043e\u0448\u0438\u0431\u043a\u0438<\/p>\n<pre><code>sudo -u logstash \/usr\/share\/logstash\/bin\/logstash --path.settings \/etc\/logstash -t <\/code><\/pre>\n<h4>\u0417\u0430\u043f\u0443\u0441\u043a Logstash<\/h4>\n<p>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c Logstash \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u043a\u043e\u043c\u0430\u043d\u0434:<\/p>\n<pre><code>sudo systemctl start logstash sudo systemctl enable logstash <\/code><\/pre>\n<h3>Filebeat<\/h3>\n<h4>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 Filebeat &#8212; \u043a\u043b\u0438\u0435\u043d\u0442 \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u043b\u043e\u0433\u043e\u0432 \u0432 logstash<\/h4>\n<p>\u0417\u0430\u0445\u043e\u0434\u0438\u043c \u043d\u0430 \u043f\u0440\u043e\u043a\u0441\u0438 \u0441\u0435\u0440\u0432\u0435\u0440<\/p>\n<pre><code>curl -fsSL https:\/\/artifacts.elastic.co\/GPG-KEY-elasticsearch | sudo apt-key add - echo \"deb https:\/\/artifacts.elastic.co\/packages\/7.x\/apt stable main\" | sudo tee -a \/etc\/apt\/sources.list.d\/elastic-7.x.list sudo apt install filebeat <\/code><\/pre>\n<h4>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 Filebeat<\/h4>\n<p>\u0418\u0437\u043c\u0435\u043d\u044f\u0435\u043c \u0444\u0430\u0439\u043b \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0439:<\/p>\n<pre><code>sudo filebeat modules enable system sudo nano \/etc\/filebeat\/filebeat.yml <\/code><\/pre>\n<p>\u041a\u043e\u043c\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u0435\u043c \u0441\u0442\u0440\u043e\u0447\u043a\u0438 &#171;output.elasticsearch&#187; \u0438 &#171;hosts: [&#171;localhost:9200&#8243;]&#187;<\/p>\n<p>\u0420\u0430\u0441\u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u0435\u043c \u0441\u0442\u0440\u043e\u0447\u043a\u0438 &#171;output.logstash&#187; \u0438 &#171;hosts: [&#171;localhost:5044&#8243;]&#187;<\/p>\n<p>\u0418\u0437\u043c\u0435\u043d\u0438\u043c localhost \u043d\u0430 ip \u043d\u0430\u0448\u0435\u0433\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0441 ELK <\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/174\/721\/b05\/174721b05ccffb6c4a1565ced26dd265.jpeg\" width=\"1453\" height=\"644\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/174\/721\/b05\/174721b05ccffb6c4a1565ced26dd265.jpeg\" data-blurred=\"true\"\/><figcaption><\/figcaption><\/figure>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/46c\/7cc\/645\/46c7cc64584695044997653328e0d2ef.jpeg\" width=\"1285\" height=\"477\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/46c\/7cc\/645\/46c7cc64584695044997653328e0d2ef.jpeg\" data-blurred=\"true\"\/><figcaption><\/figcaption><\/figure>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e &#171;sudo filebeat -e test output&#187;<br \/> \u0422\u0430\u043a \u043a\u0430\u043a \u043c\u044b \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0432 Logstash, \u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u0440\u0443\u0447\u043d\u0443\u044e \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u044b \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u0443:<\/p>\n<pre><code>sudo filebeat setup --pipelines --modules system <\/code><\/pre>\n<p>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c index templates \u0434\u043b\u044f Elasticsearch \u0432\u0440\u0443\u0447\u043d\u0443\u044e.<\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0448\u0430\u0431\u043b\u043e\u043d \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u0432\u0440\u0443\u0447\u043d\u0443\u044e, \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438. \u0422\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043a Elasticsearch, \u043d\u043e \u0442.\u043a. \u0432\u043a\u043b\u044e\u0447\u0435\u043d \u0434\u0440\u0443\u0433\u043e\u0439 \u0432\u044b\u0432\u043e\u0434, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u043e\u0442\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u0432\u044b\u0432\u043e\u0434 \u0438 \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c Elasticsearch \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 -E. \u041e\u0442\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 Logstash.<\/p>\n<pre><code>sudo filebeat setup --index-management -E output.logstash.enabled=false -E 'output.elasticsearch.hosts=[\"139.59.247.231:9200\"]' -E 'output.elasticsearch.username=\"dasha\"' -E 'output.elasticsearch.password=\"123456\"' sudo filebeat setup --index-management -E output.logstash.enabled=false -E 'output.elasticsearch.hosts=[\"139.59.247.231:9200\"]' -E 'output.elasticsearch.username=\"dasha\"' -E 'output.elasticsearch.password=\"123456\"' -E setup.kibana.host=139.59.247.231:5601 <\/code><\/pre>\n<p>139.59.247.231 elk ip<\/p>\n<h4>\u0417\u0430\u043f\u0443\u0441\u043a Filebeat<\/h4>\n<p>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c Filebeat \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u043a\u043e\u043c\u0430\u043d\u0434:<\/p>\n<pre><code>sudo systemctl start filebeat sudo systemctl enable filebeat curl -u dasha:123456 -XGET 'http:\/\/139.59.247.231:9200\/filebeat-*\/_search?pretty' <\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/c7e\/d51\/0f7\/c7ed510f7db74d9f4f47380ceaccee2c.jpeg\" width=\"1905\" height=\"955\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/c7e\/d51\/0f7\/c7ed510f7db74d9f4f47380ceaccee2c.jpeg\" data-blurred=\"true\"\/><figcaption><\/figcaption><\/figure>\n<h3>GROK<\/h3>\n<p>Grok-\u044d\u0442\u043e \u0444\u0438\u043b\u044c\u0442\u0440 \u0432\u043d\u0443\u0442\u0440\u0438 Logstash, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0440\u0430\u0437\u0431\u043e\u0440\u0430 \u043d\u0435\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 \u0447\u0442\u043e-\u0442\u043e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u0438 \u043f\u043e\u0434\u043b\u0435\u0436\u0430\u0449\u0435\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u0443. \u041e\u043d \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043f\u043e\u0432\u0435\u0440\u0445 \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u043e\u0433\u043e \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f (regex) \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u044b \u0434\u043b\u044f \u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u0442\u0440\u043e\u043a \u0432 \u0444\u0430\u0439\u043b\u0430\u0445 \u0436\u0443\u0440\u043d\u0430\u043b\u043e\u0432.<\/p>\n<h4>\u041f\u0440\u0430\u0432\u0438\u043b\u043e 1<\/h4>\n<p>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u043b\u043e\u0433\u0438<\/p>\n<pre><code class=\"json\">{   \"fields\" : {     \"message\": [         \"May  1 10:01:37 proxy sshd[87897]: Failed password for root from 49.88.112.76 port 14398 ssh2\"       ]   } } <\/code><\/pre>\n<p>Grok<\/p>\n<pre><code>%{SYSLOGTIMESTAMP} %{WORD:server_name} %{WORD:service_name}\\[%{NUMBER:pid}\\]: Failed password for %{WORD:user_name} from %{IP:source_ip} port %{NUMBER:port} <\/code><\/pre>\n<p>\u041d\u043e\u0432\u044b\u0435 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u043b\u043e\u0433\u0438<\/p>\n<pre><code class=\"json\">{   \"fields\": {     \"server_name\": [       \"proxy\"     ],     \"user_name\": [       \"root\"     ],     \"pid\": [       \"87897\"     ],     \"source_ip\": [       \"49.88.112.76\"     ],     \"service_name\": [       \"sshd\"     ],     \"message\": [       \"May  1 10:01:37 proxy sshd[87897]: Failed password for root from 49.88.112.76 port 14398 ssh2\"     ],     \"tags\": [       \"beats_input_codec_plain_applied\"     ],     \"port\": [       \"14398\"     ]   } } <\/code><\/pre>\n<h4>\u041f\u0440\u0430\u0432\u0438\u043b\u043e 2<\/h4>\n<p>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u043b\u043e\u0433\u0438<\/p>\n<pre><code class=\"json\">{   \"fields\": {     \"message\": [       \"Apr 27 02:13:09 proxy sshd[5803]: Received disconnect from 124.156.222.134 port 46278:11: Bye Bye [preauth]\"     ]   } } <\/code><\/pre>\n<p>Grok<\/p>\n<pre><code>%{SYSLOGTIMESTAMP} %{WORD:server_name} sshd\\[%{NUMBER}\\]: Received disconnect from %{IP:source_ip} port %{NUMBER:port}:%{DATA}: %{GREEDYDATA:msg} <\/code><\/pre>\n<p>\u041d\u043e\u0432\u044b\u0435 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u043b\u043e\u0433\u0438<\/p>\n<pre><code class=\"json\">{   \"fields\": {     \"msg\": [       \"Bye Bye [preauth]\"     ],     \"server_name\": [       \"proxy\"     ],     \"source_ip\": [       \"14.224.148.16\"     ],     \"message\": [       \"May  1 10:25:28 proxy sshd[88097]: Received disconnect from 14.224.148.16 port 36408:11: Bye Bye [preauth]\"     ],     \"tags\": [       \"beats_input_codec_plain_applied\"     ],     \"port\": [       \"36408\"     ]   } } <\/code><\/pre>\n<h4>\u041f\u0440\u0430\u0432\u0438\u043b\u043e 3<\/h4>\n<p>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u043b\u043e\u0433\u0438<\/p>\n<pre><code class=\"json\">{   \"fields\": {     \"message\": [       \"May  1 10:31:28 proxy sshd[88184]: Disconnected from authenticating user root 165.22.63.216 port 33010 [preauth]\"     ]   } } <\/code><\/pre>\n<p>Grok<\/p>\n<pre><code>%{SYSLOGTIMESTAMP} %{WORD:server_name} sshd\\[%{NUMBER}\\]: %{WORD:status} from authenticating user %{WORD:user_name} %{IP:source_ip} port %{NUMBER:port} <\/code><\/pre>\n<p>\u041d\u043e\u0432\u044b\u0435 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u043b\u043e\u0433\u0438<\/p>\n<pre><code class=\"json\">{   \"fields\": {     \"server_name\": [       \"proxy\"     ],     \"user_name\": [       \"root\"     ],     \"source_ip\": [       \"124.194.74.203\"     ],     \"message\": [       \"May  1 10:39:30 proxy sshd[88242]: Disconnected from authenticating user root 124.194.74.203 port 40918 [preauth]\"     ],     \"tags\": [       \"beats_input_codec_plain_applied\"     ],     \"port\": [       \"40918\"     ],     \"status\": [       \"Disconnected\"     ]   } } <\/code><\/pre>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"v-portal\" style=\"display:none;\"><\/div>\n<\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/665072\/\"> https:\/\/habr.com\/ru\/post\/665072\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<h3>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 Squid proxy<\/h3>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c squid \u0434\u043b\u044f \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0440\u043e\u043a\u0441\u0438-\u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b:<\/p>\n<pre><code>sudo apt install squid <\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438, squid \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0444\u0430\u0439\u043b .conf \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b:<\/p>\n<pre><code>sudo nano \/etc\/squid\/squid.conf <\/code><\/pre>\n<p>\u0412 \u043e\u0442\u043a\u0440\u044b\u0442\u043e\u043c \u0444\u0430\u0439\u043b\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043d\u0430\u0436\u0438\u043c\u0430\u0435\u043c Ctrl+W \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0439\u0442\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0435 \u043c\u0435\u0441\u0442\u043e \u0438 \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u0442\u044c:<\/p>\n<pre><code>include \/etc\/squid\/conf.d\/* <\/code><\/pre>\n<p>\u0412 \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u043e\u043c \u043c\u0435\u0441\u0442\u0435 \u043d\u0438\u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0441\u0442\u0440\u043e\u0447\u043a\u0438 \u0438 \u043f\u043e\u043b\u0435 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b:<\/p>\n<pre><code>auth_param basic program \/usr\/lib\/squid3\/basic_ncsa_auth \/etc\/squid\/passwords` auth_param basic realm proxy` acl authenticated proxy_auth REQUIRED` acl localnet src  176.59.142.172 http_access allow authenticated <\/code><\/pre>\n<p>176.59.142.172 &#8212; ip \u0430\u0434\u0440\u0435\u0441 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u044b. <\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<h4>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 Apache<\/h4>\n<p>\u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c Apache \u0434\u043b\u044f \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u0433\u043e \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u0440\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0435 \u0438 \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e \u043f\u043e \u043f\u0430\u0440\u043e\u043b\u044e<\/p>\n<pre><code>sudo apt install apache2-utils sudo htpasswd -c \/etc\/squid\/passwords *squid_username* <\/code><\/pre>\n<h4>\u0417\u0430\u043f\u0443\u0441\u043a \u0441\u0435\u0440\u0432\u0435\u0440\u0430<\/h4>\n<p>\u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e squid \u0441\u043b\u0443\u0448\u0430\u0435\u0442 3128 \u043f\u043e\u0440\u0442<\/p>\n<pre><code>sudo systemctl start squid sudo systemctl enable squid sudo ufw allow 3128 <\/code><\/pre>\n<p>\u0412\u0438\u0434\u0438\u043c, \u0447\u0442\u043e \u043f\u0440\u043e\u043a\u0441\u0438 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442: <\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<h3>Elasticsearch<\/h3>\n<h4>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 Java<\/h4>\n<p>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c Java \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u043a\u043e\u043c\u0430\u043d\u0434:<\/p>\n<pre><code>sudo apt update sudo apt install default-jre sudo apt install default-jdk <\/code><\/pre>\n<h4>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 Elasticsearch<\/h4>\n<p>Elasticsearch \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f, \u0430\u043d\u0430\u043b\u0438\u0437\u0430, \u043f\u043e\u0438\u0441\u043a\u0430 \u043f\u043e \u043b\u043e\u0433\u0430\u043c.<br \/> \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c cURL, \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e URL, \u0434\u043b\u044f \u0438\u043c\u043f\u043e\u0440\u0442\u0430 \u043e\u0442\u043a\u0440\u044b\u0442\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430 Elasticsearch GPG \u0432 APT. \u0422\u0430\u043a \u0436\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b -fsSL \u0434\u043b\u044f \u043f\u043e\u0434\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0432\u0441\u0435\u0445 \u0442\u0435\u043a\u0443\u0449\u0438\u0445 \u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u043e\u0448\u0438\u0431\u043e\u043a (\u043a\u0440\u043e\u043c\u0435 \u0441\u0431\u043e\u044f \u0441\u0435\u0440\u0432\u0435\u0440\u0430), \u0430 \u0442\u0430\u043a\u0436\u0435, \u0447\u0442\u043e\u0431\u044b \u0440\u0430\u0437\u0440\u0435\u0448\u0438\u0442\u044c cURL \u043f\u043e\u0434\u0430\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0434\u0440\u0443\u0433\u043e\u0439 \u043b\u043e\u043a\u0430\u0446\u0438\u0438 \u043f\u0440\u0438 \u043f\u0435\u0440\u0435\u0430\u0434\u0440\u0435\u0441\u0430\u0446\u0438\u0438. \u0412\u044b\u0432\u043e\u0434\u0438\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043a\u043e\u043c\u0430\u043d\u0434\u044b cURL \u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 apt-key, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0434\u043e\u0431\u0430\u0432\u0438\u0442 \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0439 \u043a\u043b\u044e\u0447 GPG \u0432 APT<\/p>\n<pre><code>curl -fsSL https:\/\/artifacts.elastic.co\/GPG-KEY-elasticsearch | sudo apt-key add - <\/code><\/pre>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0441\u043f\u0438\u0441\u043e\u043a \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u0432 Elastic \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433 sources.list.d, \u0433\u0434\u0435 APT \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043a\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0435 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0438:<\/p>\n<pre><code>echo \"deb https:\/\/artifacts.elastic.co\/packages\/7.x\/apt stable main\" | sudo tee -a \/etc\/apt\/sources.list.d\/elastic-7.x.list <\/code><\/pre>\n<p>\u041e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u043c \u0441\u043f\u0438\u0441\u043e\u043a \u043f\u0430\u043a\u0435\u0442\u043e\u0432, \u0447\u0442\u043e\u0431\u044b APT \u043c\u043e\u0433 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0439 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a Elastic \u0438 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c Elasticksearch \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b:<\/p>\n<pre><code>sudo apt update sudo apt install elasticsearch <\/code><\/pre>\n<h4>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 Elasticsearch<\/h4>\n<p>\u0414\u043b\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 Elasticsearch \u043c\u044b \u043e\u0442\u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u0443\u0435\u043c \u0444\u0430\u0439\u043b\u044b \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438. \u0412 Elasticsearch \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u0442\u0440\u0438 \u0444\u0430\u0439\u043b\u0430 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438:<\/p>\n<ul>\n<li>\n<p>elasticsearch.yml \u0434\u043b\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 Elasticsearch, \u0433\u043b\u0430\u0432\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438<\/p>\n<\/li>\n<li>\n<p>jvm.options \u0434\u043b\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u044b Elasticsearch Java Virtual Machine (JVM)<\/p>\n<\/li>\n<li>\n<p>log4j2.properties \u0434\u043b\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0436\u0443\u0440\u043d\u0430\u043b\u0430 Elasticsearch<\/p>\n<\/li>\n<\/ul>\n<p>\u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0444\u0430\u0439\u043b elasticsearch.yml \u0434\u043b\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0439. \u0424\u0430\u0439\u043b elasticsearch.yml \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0434\u043b\u044f \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430, \u0443\u0437\u043b\u0430, \u043f\u0443\u0442\u0438, \u043f\u0430\u043c\u044f\u0442\u0438, \u0441\u0435\u0442\u0438, \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u0438 \u0448\u043b\u044e\u0437\u0430. \u041d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0445\u043e\u0441\u0442\u0430 \u0441\u0435\u0442\u0438.<\/p>\n<pre><code>sudo nano \/etc\/elasticsearch\/elasticsearch.yml <\/code><\/pre>\n<p>\u0414\u043b\u044f \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u0438 \u043f\u043e\u0432\u044b\u0448\u0435\u043d\u0438\u044f \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 \u043d\u0430\u0445\u043e\u0434\u0438\u043c \u0441\u0442\u0440\u043e\u043a\u0443 \u0441 \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u0435\u043c network.host \u0438 \u0443\u0431\u0438\u0440\u0430\u0435\u043c \u0441 \u043d\u0435\u0435 \u0437\u043d\u0430\u0447\u043e\u043a \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0437\u0430\u043c\u0435\u043d\u044f\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043d\u0430 0.0.0.0, \u0447\u0442\u043e\u0431\u044b \u043e\u043d\u0430 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u043b\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c: &#171;network.host: 0.0.0.0&#187;.<br \/> Elasticsearch \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442 \u043e\u0434\u043d\u043e\u0443\u0437\u043b\u043e\u0432\u043e\u0439 \u043a\u043b\u0430\u0441\u0442\u0435\u0440: discovery.type: single-node.<br \/> \u0412\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 Elasticsearch \u043d\u0430 \u0443\u0437\u043b\u0435: xpack.security.enabled: true.<\/p>\n<h4>\u0417\u0430\u043f\u0443\u0441\u043a Elasticsearch<\/h4>\n<p>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c Elasticsearch \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u043a\u043e\u043c\u0430\u043d\u0434:<\/p>\n<pre><code>sudo systemctl start elasticsearch sudo systemctl enable elasticsearch <\/code><\/pre>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<h4>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439<\/h4>\n<pre><code>sudo -u root \/usr\/share\/elasticsearch\/bin\/elasticsearch-setup-passwords auto <\/code><\/pre>\n<p>\u0421\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0432\u044b\u0432\u043e\u0434<\/p>\n<pre><code>Changed password for user apm_system PASSWORD apm_system = Ff7GWmJSS4X45NewBNZN  Changed password for user kibana_system PASSWORD kibana_system = OZ7w09XTeHBg3rfihAsm  Changed password for user kibana PASSWORD kibana = OZ7w09XTeHBg3rfihAsm  Changed password for user logstash_system PASSWORD logstash_system = AKtK2rmOmkAwWfL17jCh  Changed password for user beats_system PASSWORD beats_system = ymq4MVVHCdDIVBohH5l7  Changed password for user remote_monitoring_user PASSWORD remote_monitoring_user = RbkSKKbivgZOoq02plda  Changed password for user elastic PASSWORD elastic = nrRO28jYIplnaEP3JBou <\/code><\/pre>\n<h3>Kibana<\/h3>\n<h4>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 Kibana<\/h4>\n<p>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c Kibana, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u0443\u0434\u043e\u0431\u043d\u0443\u044e \u0438 \u043a\u0440\u0430\u0441\u0438\u0432\u0443\u044e web \u043f\u0430\u043d\u0435\u043b\u044c \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043b\u043e\u0433\u0430\u043c\u0438, \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b:<\/p>\n<pre><code>sudo apt install kibana <\/code><\/pre>\n<h4>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 Kibana<\/h4>\n<p>\u041e\u0442\u043a\u0440\u043e\u0435\u043c \u0444\u0430\u0439\u043b \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438:<\/p>\n<pre><code>sudo nano \/etc\/kibana\/kibana.yml <\/code><\/pre>\n<p>\u041d\u0430\u0441\u0442\u0440\u043e\u0438\u043c username \u0438 \u0443\u043a\u0430\u0436\u0435\u043c, \u0447\u0442\u043e Elasticsearch \u0434\u043e\u043b\u0436\u043d\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u0430 \u043f\u043e\u0440\u0442\u0443 9200, \u0430 Kibana \u043d\u0430 5601:<\/p>\n<pre><code>elasticsearch.username: \"kibana_system\" elasticsearch.host: \"0.0.0.0:9200\" kibana.port: 5601 <\/code><\/pre>\n<h4>\u0417\u0430\u043f\u0443\u0441\u043a Kibana<\/h4>\n<p>\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u043c Kibana \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u043a\u043e\u043c\u0430\u043d\u0434:<\/p>\n<pre><code>sudo systemctl start kibana sudo systemctl enable kibana <\/code><\/pre>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<h4>\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u0430\u0440\u043e\u043b\u044f<\/h4>\n<pre><code>sudo -u root \/usr\/share\/kibana\/bin\/kibana-keystore create sudo -u root \/usr\/share\/kibana\/bin\/kibana-keystore add elasticsearch.password <\/code><\/pre>\n<p>\u0412\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u043f\u0430\u0440\u043e\u043b\u044c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439<\/p>\n<pre><code>Changed password for user kibana_system PASSWORD kibana_system = OZ7w09XTeHBg3rfihAsm <\/code><\/pre>\n<p>\u0417\u0430\u0445\u043e\u0434\u0438\u043c \u0432 Elasticsearch, \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0441\u0443\u043f\u0435\u0440\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<h3>Logstash<\/h3>\n<h4>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 Logstash<\/h4>\n<p>\u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c Logstash- \u0441\u0435\u0440\u0432\u0438\u0441 \u0434\u043b\u044f \u0441\u0431\u043e\u0440\u0430 \u043b\u043e\u0433\u043e\u0432 \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0438\u0445 \u0432 Elasticsearch.<\/p>\n<pre><code>sudo apt install logstash <\/code><\/pre>\n<h4>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 Logstash<\/h4>\n<p>\u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0444\u0430\u0439\u043b \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0439:<\/p>\n<pre><code>sudo nano \/etc\/logstash\/conf.d\/logstash.conf <\/code><\/pre>\n<p>\u0423\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c, \u0447\u0442\u043e \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u043c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043d\u0430 5044 \u043f\u043e\u0440\u0442, \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u0433\u0434\u0435 \u0432 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c \u0431\u0443\u0434\u0443\u0442 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u043f\u0440\u0430\u0432\u0438\u043b\u0430,  \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 Elasticsearch \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c.<\/p>\n<pre><code>input {      beats {          port => 5044      } }  filter {   **\u041c\u0435\u0441\u0442\u043e \u0434\u043b\u044f \u043f\u0440\u0430\u0432\u0438\u043b Grok** }  output {   elasticsearch {     hosts => [\"139.59.247.231:9200\"]     manage_template => false      index => \"%{[@metadata][beat]}-%{[@metadata[version]}-%{+YYYY.MM.dd}\"     user => \"user\"     password => \"password\"   } }  <\/code><\/pre>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441, \u0447\u0442\u043e\u0431\u044b \u0432 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c \u043d\u0435 \u043f\u043e\u044f\u0432\u0438\u043b\u0438\u0441\u044c \u043e\u0448\u0438\u0431\u043a\u0438<\/p>\n<pre><code>sudo -u logstash \/usr\/share\/logstash\/bin\/logstash --path.settings \/etc\/logstash -t <\/code><\/pre>\n<h4>\u0417\u0430\u043f\u0443\u0441\u043a Logstash<\/h4>\n<p>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c Logstash \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u043a\u043e\u043c\u0430\u043d\u0434:<\/p>\n<pre><code>sudo systemctl start logstash sudo systemctl enable logstash <\/code><\/pre>\n<h3>Filebeat<\/h3>\n<h4>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 Filebeat &#8212; \u043a\u043b\u0438\u0435\u043d\u0442 \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u043b\u043e\u0433\u043e\u0432 \u0432 logstash<\/h4>\n<p>\u0417\u0430\u0445\u043e\u0434\u0438\u043c \u043d\u0430 \u043f\u0440\u043e\u043a\u0441\u0438 \u0441\u0435\u0440\u0432\u0435\u0440<\/p>\n<pre><code>curl -fsSL https:\/\/artifacts.elastic.co\/GPG-KEY-elasticsearch | sudo apt-key add - echo \"deb https:\/\/artifacts.elastic.co\/packages\/7.x\/apt stable main\" | sudo tee -a \/etc\/apt\/sources.list.d\/elastic-7.x.list sudo apt install filebeat <\/code><\/pre>\n<h4>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 Filebeat<\/h4>\n<p>\u0418\u0437\u043c\u0435\u043d\u044f\u0435\u043c \u0444\u0430\u0439\u043b \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0439:<\/p>\n<pre><code>sudo filebeat modules enable system sudo nano \/etc\/filebeat\/filebeat.yml <\/code><\/pre>\n<p>\u041a\u043e\u043c\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u0435\u043c \u0441\u0442\u0440\u043e\u0447\u043a\u0438 &#171;output.elasticsearch&#187; \u0438 &#171;hosts: [&#171;localhost:9200&#8243;]&#187;<\/p>\n<p>\u0420\u0430\u0441\u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u0435\u043c \u0441\u0442\u0440\u043e\u0447\u043a\u0438 &#171;output.logstash&#187; \u0438 &#171;hosts: [&#171;localhost:5044&#8243;]&#187;<\/p>\n<p>\u0418\u0437\u043c\u0435\u043d\u0438\u043c localhost \u043d\u0430 ip \u043d\u0430\u0448\u0435\u0433\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0441 ELK <\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e &#171;sudo filebeat -e test output&#187;<br \/> \u0422\u0430\u043a \u043a\u0430\u043a \u043c\u044b \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0432 Logstash, \u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u0440\u0443\u0447\u043d\u0443\u044e \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u044b \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u0443:<\/p>\n<pre><code>sudo filebeat setup --pipelines --modules system <\/code><\/pre>\n<p>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c index templates \u0434\u043b\u044f Elasticsearch \u0432\u0440\u0443\u0447\u043d\u0443\u044e.<\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0448\u0430\u0431\u043b\u043e\u043d \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u0432\u0440\u0443\u0447\u043d\u0443\u044e, \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438. \u0422\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043a Elasticsearch, \u043d\u043e \u0442.\u043a. \u0432\u043a\u043b\u044e\u0447\u0435\u043d \u0434\u0440\u0443\u0433\u043e\u0439 \u0432\u044b\u0432\u043e\u0434, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u043e\u0442\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u0432\u044b\u0432\u043e\u0434 \u0438 \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c Elasticsearch \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 -E. \u041e\u0442\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 Logstash.<\/p>\n<pre><code>sudo filebeat setup --index-management -E output.logstash.enabled=false -E 'output.elasticsearch.hosts=[\"139.59.247.231:9200\"]' -E 'output.elasticsearch.username=\"dasha\"' -E 'output.elasticsearch.password=\"123456\"' sudo filebeat setup --index-management -E output.logstash.enabled=false -E 'output.elasticsearch.hosts=[\"139.59.247.231:9200\"]' -E 'output.elasticsearch.username=\"dasha\"' -E 'output.elasticsearch.password=\"123456\"' -E setup.kibana.host=139.59.247.231:5601 <\/code><\/pre>\n<p>139.59.247.231 elk ip<\/p>\n<h4>\u0417\u0430\u043f\u0443\u0441\u043a Filebeat<\/h4>\n<p>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c Filebeat \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u043a\u043e\u043c\u0430\u043d\u0434:<\/p>\n<pre><code>sudo systemctl start filebeat sudo systemctl enable filebeat curl -u dasha:123456 -XGET 'http:\/\/139.59.247.231:9200\/filebeat-*\/_search?pretty' <\/code><\/pre>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<h3>GROK<\/h3>\n<p>Grok-\u044d\u0442\u043e \u0444\u0438\u043b\u044c\u0442\u0440 \u0432\u043d\u0443\u0442\u0440\u0438 Logstash, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0440\u0430\u0437\u0431\u043e\u0440\u0430 \u043d\u0435\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 \u0447\u0442\u043e-\u0442\u043e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u0438 \u043f\u043e\u0434\u043b\u0435\u0436\u0430\u0449\u0435\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u0443. \u041e\u043d \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043f\u043e\u0432\u0435\u0440\u0445 \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u043e\u0433\u043e \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f (regex) \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u044b \u0434\u043b\u044f \u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u0442\u0440\u043e\u043a \u0432 \u0444\u0430\u0439\u043b\u0430\u0445 \u0436\u0443\u0440\u043d\u0430\u043b\u043e\u0432.<\/p>\n<h4>\u041f\u0440\u0430\u0432\u0438\u043b\u043e 1<\/h4>\n<p>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u043b\u043e\u0433\u0438<\/p>\n<pre><code class=\"json\">{   \"fields\" : {     \"message\": [         \"May  1 10:01:37 proxy sshd[87897]: Failed password for root from 49.88.112.76 port 14398 ssh2\"       ]   } } <\/code><\/pre>\n<p>Grok<\/p>\n<pre><code>%{SYSLOGTIMESTAMP} %{WORD:server_name} %{WORD:service_name}\\[%{NUMBER:pid}\\]: Failed password for %{WORD:user_name} from %{IP:source_ip} port %{NUMBER:port} <\/code><\/pre>\n<p>\u041d\u043e\u0432\u044b\u0435 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u043b\u043e\u0433\u0438<\/p>\n<pre><code class=\"json\">{   \"fields\": {     \"server_name\": [       \"proxy\"     ],     \"user_name\": [       \"root\"     ],     \"pid\": [       \"87897\"     ],     \"source_ip\": [       \"49.88.112.76\"     ],     \"service_name\": [       \"sshd\"     ],     \"message\": [       \"May  1 10:01:37 proxy sshd[87897]: Failed password for root from 49.88.112.76 port 14398 ssh2\"     ],     \"tags\": [       \"beats_input_codec_plain_applied\"     ],     \"port\": [       \"14398\"     ]   } } <\/code><\/pre>\n<h4>\u041f\u0440\u0430\u0432\u0438\u043b\u043e 2<\/h4>\n<p>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u043b\u043e\u0433\u0438<\/p>\n<pre><code class=\"json\">{   \"fields\": {     \"message\": [       \"Apr 27 02:13:09 proxy sshd[5803]: Received disconnect from 124.156.222.134 port 46278:11: Bye Bye [preauth]\"     ]   } } <\/code><\/pre>\n<p>Grok<\/p>\n<pre><code>%{SYSLOGTIMESTAMP} %{WORD:server_name} sshd\\[%{NUMBER}\\]: Received disconnect from %{IP:source_ip} port %{NUMBER:port}:%{DATA}: %{GREEDYDATA:msg} <\/code><\/pre>\n<p>\u041d\u043e\u0432\u044b\u0435 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u043b\u043e\u0433\u0438<\/p>\n<pre><code class=\"json\">{   \"fields\": {     \"msg\": [       \"Bye Bye [preauth]\"     ],     \"server_name\": [       \"proxy\"     ],     \"source_ip\": [       \"14.224.148.16\"     ],     \"message\": [       \"May  1 10:25:28 proxy sshd[88097]: Received disconnect from 14.224.148.16 port 36408:11: Bye Bye [preauth]\"     ],     \"tags\": [       \"beats_input_codec_plain_applied\"     ],     \"port\": [       \"36408\"     ]   } } <\/code><\/pre>\n<h4>\u041f\u0440\u0430\u0432\u0438\u043b\u043e 3<\/h4>\n<p>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u043b\u043e\u0433\u0438<\/p>\n<pre><code class=\"json\">{   \"fields\": {     \"message\": [       \"May  1 10:31:28 proxy sshd[88184]: Disconnected from authenticating user root 165.22.63.216 port 33010 [preauth]\"     ]   } } <\/code><\/pre>\n<p>Grok<\/p>\n<pre><code>%{SYSLOGTIMESTAMP} %{WORD:server_name} sshd\\[%{NUMBER}\\]: %{WORD:status} from authenticating user<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\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-332978","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/332978","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=332978"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/332978\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=332978"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=332978"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=332978"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}