{"id":394,"date":"2017-09-08T09:08:55","date_gmt":"2017-09-08T01:08:55","guid":{"rendered":"https:\/\/blog.jsjs.org\/?p=394"},"modified":"2017-09-08T09:08:55","modified_gmt":"2017-09-08T01:08:55","slug":"elkelasticsearch-logstash-kibana%e6%90%ad%e5%bb%ba%e5%ae%9e%e6%97%b6%e6%97%a5%e5%bf%97%e5%88%86%e6%9e%90%e5%b9%b3%e5%8f%b0","status":"publish","type":"post","link":"https:\/\/blog.jsjs.org\/?p=394","title":{"rendered":"ELK(ElasticSearch, Logstash, Kibana)\u642d\u5efa\u5b9e\u65f6\u65e5\u5fd7\u5206\u6790\u5e73\u53f0"},"content":{"rendered":"<h2 id=\"articleHeader0\">ELK\u5e73\u53f0\u4ecb\u7ecd<\/h2>\n<p>\u5728\u641c\u7d22ELK\u8d44\u6599\u7684\u65f6\u5019\uff0c\u53d1\u73b0\u8fd9\u7bc7\u6587\u7ae0\u6bd4\u8f83\u597d\uff0c\u4e8e\u662f\u6458\u6284\u4e00\u5c0f\u6bb5\uff1a<\/p>\n<p>\u4ee5\u4e0b\u5185\u5bb9\u6765\u81ea\uff1a<a href=\"http:\/\/baidu.blog.51cto.com\/71938\/1676798\" target=\"_blank\" rel=\"nofollow noopener\">http:\/\/baidu.blog.51cto.com\/71938\/1676798<\/a><\/p>\n<p>\u65e5\u5fd7\u4e3b\u8981\u5305\u62ec\u7cfb\u7edf\u65e5\u5fd7\u3001\u5e94\u7528\u7a0b\u5e8f\u65e5\u5fd7\u548c\u5b89\u5168\u65e5\u5fd7\u3002\u7cfb\u7edf\u8fd0\u7ef4\u548c\u5f00\u53d1\u4eba\u5458\u53ef\u4ee5\u901a\u8fc7\u65e5\u5fd7\u4e86\u89e3\u670d\u52a1\u5668\u8f6f\u786c\u4ef6\u4fe1\u606f\u3001\u68c0\u67e5\u914d\u7f6e\u8fc7\u7a0b\u4e2d\u7684\u9519\u8bef\u53ca\u9519\u8bef\u53d1\u751f\u7684\u539f\u56e0\u3002\u7ecf\u5e38\u5206\u6790\u65e5\u5fd7\u53ef\u4ee5\u4e86\u89e3\u670d\u52a1\u5668\u7684\u8d1f\u8377\uff0c\u6027\u80fd\u5b89\u5168\u6027\uff0c\u4ece\u800c\u53ca\u65f6\u91c7\u53d6\u63aa\u65bd\u7ea0\u6b63\u9519\u8bef\u3002<\/p>\n<p>\u901a\u5e38\uff0c\u65e5\u5fd7\u88ab\u5206\u6563\u7684\u50a8\u5b58\u4e0d\u540c\u7684\u8bbe\u5907\u4e0a\u3002\u5982\u679c\u4f60\u7ba1\u7406\u6570\u5341\u4e0a\u767e\u53f0\u670d\u52a1\u5668\uff0c\u4f60\u8fd8\u5728\u4f7f\u7528\u4f9d\u6b21\u767b\u5f55\u6bcf\u53f0\u673a\u5668\u7684\u4f20\u7edf\u65b9\u6cd5\u67e5\u9605\u65e5\u5fd7\u3002\u8fd9\u6837\u662f\u4e0d\u662f\u611f\u89c9\u5f88\u7e41\u7410\u548c\u6548\u7387\u4f4e\u4e0b\u3002\u5f53\u52a1\u4e4b\u6025\u6211\u4eec\u4f7f\u7528\u96c6\u4e2d\u5316\u7684\u65e5\u5fd7\u7ba1\u7406\uff0c\u4f8b\u5982\uff1a\u5f00\u6e90\u7684syslog\uff0c\u5c06\u6240\u6709\u670d\u52a1\u5668\u4e0a\u7684\u65e5\u5fd7\u6536\u96c6\u6c47\u603b\u3002<\/p>\n<p>\u96c6\u4e2d\u5316\u7ba1\u7406\u65e5\u5fd7\u540e\uff0c\u65e5\u5fd7\u7684\u7edf\u8ba1\u548c\u68c0\u7d22\u53c8\u6210\u4e3a\u4e00\u4ef6\u6bd4\u8f83\u9ebb\u70e6\u7684\u4e8b\u60c5\uff0c\u4e00\u822c\u6211\u4eec\u4f7f\u7528grep\u3001awk\u548cwc\u7b49Linux\u547d\u4ee4\u80fd\u5b9e\u73b0\u68c0\u7d22\u548c\u7edf\u8ba1\uff0c\u4f46\u662f\u5bf9\u4e8e\u8981\u6c42\u66f4\u9ad8\u7684\u67e5\u8be2\u3001\u6392\u5e8f\u548c\u7edf\u8ba1\u7b49\u8981\u6c42\u548c\u5e9e\u5927\u7684\u673a\u5668\u6570\u91cf\u4f9d\u7136\u4f7f\u7528\u8fd9\u6837\u7684\u65b9\u6cd5\u96be\u514d\u6709\u70b9\u529b\u4e0d\u4ece\u5fc3\u3002<\/p>\n<p>\u5f00\u6e90\u5b9e\u65f6\u65e5\u5fd7\u5206\u6790ELK\u5e73\u53f0\u80fd\u591f\u5b8c\u7f8e\u7684\u89e3\u51b3\u6211\u4eec\u4e0a\u8ff0\u7684\u95ee\u9898\uff0cELK\u7531ElasticSearch\u3001Logstash\u548cKiabana\u4e09\u4e2a\u5f00\u6e90\u5de5\u5177\u7ec4\u6210\u3002\u5b98\u65b9\u7f51\u7ad9\uff1a<a href=\"https:\/\/www.elastic.co\/products\" target=\"_blank\" rel=\"nofollow noopener\">https:\/\/www.elastic.co\/products<\/a><\/p>\n<ul>\n<li>Elasticsearch\u662f\u4e2a\u5f00\u6e90\u5206\u5e03\u5f0f\u641c\u7d22\u5f15\u64ce\uff0c\u5b83\u7684\u7279\u70b9\u6709\uff1a\u5206\u5e03\u5f0f\uff0c\u96f6\u914d\u7f6e\uff0c\u81ea\u52a8\u53d1\u73b0\uff0c\u7d22\u5f15\u81ea\u52a8\u5206\u7247\uff0c\u7d22\u5f15\u526f\u672c\u673a\u5236\uff0crestful\u98ce\u683c\u63a5\u53e3\uff0c\u591a\u6570\u636e\u6e90\uff0c\u81ea\u52a8\u641c\u7d22\u8d1f\u8f7d\u7b49\u3002<\/li>\n<li>Logstash\u662f\u4e00\u4e2a\u5b8c\u5168\u5f00\u6e90\u7684\u5de5\u5177\uff0c\u4ed6\u53ef\u4ee5\u5bf9\u4f60\u7684\u65e5\u5fd7\u8fdb\u884c\u6536\u96c6\u3001\u8fc7\u6ee4\uff0c\u5e76\u5c06\u5176\u5b58\u50a8\u4f9b\u4ee5\u540e\u4f7f\u7528\uff08\u5982\uff0c\u641c\u7d22\uff09\u3002<\/li>\n<li>Kibana \u4e5f\u662f\u4e00\u4e2a\u5f00\u6e90\u548c\u514d\u8d39\u7684\u5de5\u5177\uff0c\u5b83Kibana\u53ef\u4ee5\u4e3a Logstash \u548c ElasticSearch \u63d0\u4f9b\u7684\u65e5\u5fd7\u5206\u6790\u53cb\u597d\u7684 Web \u754c\u9762\uff0c\u53ef\u4ee5\u5e2e\u52a9\u60a8\u6c47\u603b\u3001\u5206\u6790\u548c\u641c\u7d22\u91cd\u8981\u6570\u636e\u65e5\u5fd7\u3002<\/li>\n<\/ul>\n<p><em>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/em><em>\u6458\u6284\u5185\u5bb9\u7ed3\u675f&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/em><\/p>\n<p>\u753b\u4e86\u4e00\u4e2aELK\u5de5\u4f5c\u7684\u539f\u7406\u56fe\uff1a<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/static.open-open.com\/lib\/uploadImg\/20160103\/20160103141217_662.png\" width=\"700\" height=\"361\" \/><\/p>\n<p>\u5982\u56fe\uff1aLogstash\u6536\u96c6AppServer\u4ea7\u751f\u7684Log\uff0c\u5e76\u5b58\u653e\u5230ElasticSearch\u96c6\u7fa4\u4e2d\uff0c\u800cKibana\u5219\u4eceES\u96c6\u7fa4\u4e2d\u67e5\u8be2\u6570\u636e\u751f\u6210\u56fe\u8868\uff0c\u518d\u8fd4\u56de\u7ed9Browser\u3002<\/p>\n<h2 id=\"articleHeader1\">ELK\u5e73\u53f0\u642d\u5efa<\/h2>\n<h4><strong>\u7cfb\u7edf\u73af\u5883<\/strong><\/h4>\n<p>System: Centos release 6.7 (Final)<\/p>\n<p>ElasticSearch: 2.1.0<\/p>\n<p>Logstash: 2.1.1<\/p>\n<p>Kibana: 4.3.0<\/p>\n<p>Java: openjdk version \u00a0&#8220;1.8.0_65&#8221;<\/p>\n<p>\u6ce8\uff1a\u7531\u4e8eLogstash\u7684\u8fd0\u884c\u4f9d\u8d56\u4e8eJava\u73af\u5883\uff0c \u800cLogstash 1.5\u4ee5\u4e0a\u7248\u672c\u4e0d\u4f4e\u4e8ejava 1.7\uff0c\u56e0\u6b64\u63a8\u8350\u4f7f\u7528\u6700\u65b0\u7248\u672c\u7684Java\u3002\u56e0\u4e3a\u6211\u4eec\u53ea\u9700\u8981Java\u7684\u8fd0\u884c\u73af\u5883\uff0c\u6240\u4ee5\u53ef\u4ee5\u53ea\u5b89\u88c5JRE\uff0c\u4e0d\u8fc7\u8fd9\u91cc\u6211\u4f9d\u7136\u4f7f\u7528JDK\uff0c\u8bf7\u81ea\u884c\u641c\u7d22\u5b89\u88c5\u3002<\/p>\n<p>ELK\u4e0b\u8f7d\uff1a<a href=\"https:\/\/www.elastic.co\/downloads\/\" target=\"_blank\" rel=\"nofollow noopener\">https:\/\/www.elastic.co\/downloads\/<\/a><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/static.open-open.com\/lib\/uploadImg\/20160103\/20160103141217_296.png\" width=\"545\" height=\"587\" \/><\/p>\n<h4><\/h4>\n<h4>ElasticSearch<\/h4>\n<p>\u914d\u7f6eElasticSearch\uff1a<\/p>\n<pre class=\"brush:java; toolbar: true; auto-links: false;\">tar\u00a0-zxvf\u00a0elasticsearch-2.1.0.tar.gz\ncd\u00a0elasticsearch-2.1.0<\/pre>\n<p>\u5b89\u88c5Head\u63d2\u4ef6\uff08Optional\uff09\uff1a<\/p>\n<pre class=\"brush:java; toolbar: true; auto-links: false;\">.\/bin\/plugin\u00a0install\u00a0mobz\/elasticsearch-head<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/static.open-open.com\/lib\/uploadImg\/20160103\/20160103141217_52.png\" width=\"666\" height=\"257\" \/><\/p>\n<p>\u7136\u540e\u7f16\u8f91ES\u7684\u914d\u7f6e\u6587\u4ef6\uff1a<\/p>\n<pre class=\"brush:java; toolbar: true; auto-links: false;\">vi\u00a0config\/elasticsearch.yml<\/pre>\n<p>\u4fee\u6539\u4ee5\u4e0b\u914d\u7f6e\u9879\uff1a<\/p>\n<pre class=\"brush:java; toolbar: true; auto-links: false;\">cluster.name=es_cluster\nnode.name=node0\npath.data=\/tmp\/elasticsearch\/data\npath.logs=\/tmp\/elasticsearch\/logs\n#\u5f53\u524dhostname\u6216IP\uff0c\u6211\u8fd9\u91cc\u662fcentos2\nnetwork.host=centos2\nnetwork.port=9200<\/pre>\n<p>\u5176\u4ed6\u7684\u9009\u9879\u4fdd\u6301\u9ed8\u8ba4\uff0c\u7136\u540e\u542f\u52a8ES\uff1a<\/p>\n<pre class=\"brush:java; toolbar: true; auto-links: false;\">.\/bin\/elasticsearch<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/static.open-open.com\/lib\/uploadImg\/20160103\/20160103141217_741.png\" width=\"700\" height=\"305\" \/><\/p>\n<p>\u53ef\u4ee5\u770b\u5230\uff0c\u5b83\u8ddf\u5176\u4ed6\u7684\u8282\u70b9\u7684\u4f20\u8f93\u7aef\u53e3\u4e3a9300\uff0c\u63a5\u53d7HTTP\u8bf7\u6c42\u7684\u7aef\u53e3\u4e3a9200\u3002<\/p>\n<p>\u4f7f\u7528ctrl+C\u505c\u6b62\u3002\u5f53\u7136\uff0c\u4e5f\u53ef\u4ee5\u4f7f\u7528\u540e\u53f0\u8fdb\u7a0b\u7684\u65b9\u5f0f\u542f\u52a8ES\uff1a<\/p>\n<pre class=\"brush:java; toolbar: true; auto-links: false;\">.\/bin\/elasticsearch\u00a0&amp;<\/pre>\n<p>\u7136\u540e\u53ef\u4ee5\u6253\u5f00\u9875\u9762localhost:9200\uff0c\u5c06\u4f1a\u770b\u5230\u4ee5\u4e0b\u5185\u5bb9\uff1a<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/static.open-open.com\/lib\/uploadImg\/20160103\/20160103141218_341.png\" width=\"492\" height=\"263\" \/><\/p>\n<p>\u8fd4\u56de\u5c55\u793a\u4e86\u914d\u7f6e\u7684cluster_name\u548cname\uff0c\u4ee5\u53ca\u5b89\u88c5\u7684ES\u7684\u7248\u672c\u7b49\u4fe1\u606f\u3002<\/p>\n<p>\u521a\u521a\u5b89\u88c5\u7684head\u63d2\u4ef6\uff0c\u5b83\u662f\u4e00\u4e2a\u7528\u6d4f\u89c8\u5668\u8ddfES\u96c6\u7fa4\u4ea4\u4e92\u7684\u63d2\u4ef6\uff0c\u53ef\u4ee5\u67e5\u770b\u96c6\u7fa4\u72b6\u6001\u3001\u96c6\u7fa4\u7684doc\u5185\u5bb9\u3001\u6267\u884c\u641c\u7d22\u548c\u666e\u901a\u7684Rest\u8bf7\u6c42\u7b49\u3002\u73b0\u5728\u4e5f\u53ef\u4ee5\u4f7f\u7528\u5b83\u6253\u5f00<a href=\"http:\/\/localhost:9200\/_plugin\/head\" target=\"_blank\" rel=\"nofollow noopener\">localhost:9200\/_plugin\/head<\/a>\u9875\u9762\u6765\u67e5\u770bES\u96c6\u7fa4\u72b6\u6001\uff1a<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/static.open-open.com\/lib\/uploadImg\/20160103\/20160103141218_508.png\" width=\"735\" height=\"249\" \/><\/p>\n<p>\u53ef\u4ee5\u770b\u5230\uff0c\u73b0\u5728\uff0cES\u96c6\u7fa4\u4e2d\u6ca1\u6709index\uff0c\u4e5f\u6ca1\u6709type\uff0c\u56e0\u6b64\u8fd9\u4e24\u6761\u662f\u7a7a\u7684\u3002<\/p>\n<h4><strong>Logstash<\/strong><\/h4>\n<p>Logstash\u7684\u529f\u80fd\u5982\u4e0b\uff1a<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/static.open-open.com\/lib\/uploadImg\/20160103\/20160103141218_82.png\" width=\"700\" height=\"278\" \/><\/p>\n<p>\u5176\u5b9e\u5b83\u5c31\u662f\u4e00\u4e2a<strong>\u6536\u96c6\u5668<\/strong>\u800c\u5df2\uff0c\u6211\u4eec\u9700\u8981\u4e3a\u5b83\u6307\u5b9aInput\u548cOutput\uff08\u5f53\u7136Input\u548cOutput\u53ef\u4ee5\u4e3a\u591a\u4e2a\uff09\u3002\u7531\u4e8e\u6211\u4eec\u9700\u8981\u628aJava\u4ee3\u7801\u4e2dLog4j\u7684\u65e5\u5fd7\u8f93\u51fa\u5230ElasticSearch\u4e2d\uff0c\u56e0\u6b64\u8fd9\u91cc\u7684Input\u5c31\u662fLog4j\uff0c\u800cOutput\u5c31\u662fElasticSearch\u3002<\/p>\n<p>\u914d\u7f6eLogstash\uff1a<\/p>\n<pre class=\"brush:java; toolbar: true; auto-links: false;\">tar\u00a0-zxvf\u00a0logstash-2.1.1.tar.gz\ncd\u00a0logstash-2.1.1<\/pre>\n<p>\u7f16\u5199\u914d\u7f6e\u6587\u4ef6(\u540d\u5b57\u548c\u4f4d\u7f6e\u53ef\u4ee5\u968f\u610f\uff0c\u8fd9\u91cc\u6211\u653e\u5728config\u76ee\u5f55\u4e0b\uff0c\u53d6\u540d\u4e3alog4j_to_es.conf)\uff1a<\/p>\n<pre class=\"brush:java; toolbar: true; auto-links: false;\">mkdir\u00a0config\nvi\u00a0config\/log4j_to_es.conf<\/pre>\n<p>\u8f93\u5165\u4ee5\u4e0b\u5185\u5bb9\uff1a<\/p>\n<pre class=\"brush:java; toolbar: true; auto-links: false;\">#\u00a0For\u00a0detail\u00a0structure\u00a0of\u00a0this\u00a0file\n#\u00a0Set:\u00a0https:\/\/www.elastic.co\/guide\/en\/logstash\/current\/configuration-file-structure.html\ninput\u00a0{\n\u00a0\u00a0#\u00a0For\u00a0detail\u00a0config\u00a0for\u00a0log4j\u00a0as\u00a0input,\u00a0\n\u00a0\u00a0#\u00a0See:\u00a0https:\/\/www.elastic.co\/guide\/en\/logstash\/current\/plugins-inputs-log4j.html\n\u00a0\u00a0log4j\u00a0{\n\u00a0\u00a0\u00a0\u00a0mode\u00a0=&gt;\u00a0\"server\"\n\u00a0\u00a0\u00a0\u00a0host\u00a0=&gt;\u00a0\"centos2\"\n\u00a0\u00a0\u00a0\u00a0port\u00a0=&gt;\u00a04567\n\u00a0\u00a0}\n}\nfilter\u00a0{\n\u00a0\u00a0#Only\u00a0matched\u00a0data\u00a0are\u00a0send\u00a0to\u00a0output.\n}\noutput\u00a0{\n\u00a0\u00a0#\u00a0For\u00a0detail\u00a0config\u00a0for\u00a0elasticsearch\u00a0as\u00a0output,\u00a0\n\u00a0\u00a0#\u00a0See:\u00a0https:\/\/www.elastic.co\/guide\/en\/logstash\/current\/plugins-outputs-elasticsearch.html\n\u00a0\u00a0elasticsearch\u00a0{\n\u00a0\u00a0\u00a0\u00a0action\u00a0=&gt;\u00a0\"index\"\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0#The\u00a0operation\u00a0on\u00a0ES\n\u00a0\u00a0\u00a0\u00a0hosts\u00a0\u00a0=&gt;\u00a0\"centos2:9200\"\u00a0\u00a0\u00a0\u00a0\u00a0#ElasticSearch\u00a0host,\u00a0can\u00a0be\u00a0array.\n\u00a0\u00a0\u00a0\u00a0index\u00a0\u00a0=&gt;\u00a0\"ec\"\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0#The\u00a0index\u00a0to\u00a0write\u00a0data\u00a0to,\u00a0can\u00a0be\u00a0any\u00a0string.\n\u00a0\u00a0}\n}<\/pre>\n<p>logstash\u547d\u4ee4\u53ea\u67092\u4e2a\u53c2\u6570\uff1a<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/static.open-open.com\/lib\/uploadImg\/20160103\/20160103141218_625.png\" width=\"459\" height=\"193\" \/><\/p>\n<p>\u56e0\u6b64\u4f7f\u7528agent\u6765\u542f\u52a8\u5b83\uff08\u4f7f\u7528-f\u6307\u5b9a\u914d\u7f6e\u6587\u4ef6\uff09\uff1a<\/p>\n<pre class=\"brush:java; toolbar: true; auto-links: false;\">.\/bin\/logstash\u00a0agent\u00a0-f\u00a0config\/log4j_to_es.conf<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/static.open-open.com\/lib\/uploadImg\/20160103\/20160103141218_924.png\" width=\"677\" height=\"122\" \/><\/p>\n<p>\u5230\u8fd9\u91cc\uff0c\u6211\u4eec\u5df2\u7ecf\u53ef\u4ee5\u4f7f\u7528Logstash\u6765\u6536\u96c6\u65e5\u5fd7\u5e76\u4fdd\u5b58\u5230ES\u4e2d\u4e86\uff0c\u4e0b\u9762\u6765\u770b\u770b\u9879\u76ee\u4ee3\u7801\u3002<\/p>\n<h4>Java\u9879\u76ee<\/h4>\n<p>\u7167\u4f8b\u5148\u770b\u9879\u76ee\u7ed3\u6784\u56fe\uff1a<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/static.open-open.com\/lib\/uploadImg\/20160103\/20160103141218_92.png\" width=\"255\" height=\"268\" \/><\/p>\n<p>pom.xml\uff0c\u5f88\u7b80\u5355\uff0c\u53ea\u7528\u5230\u4e86Log4j\u5e93\uff1a<\/p>\n<pre class=\"brush:java; toolbar: true; auto-links: false;\">&lt;dependency&gt;\n\u00a0\u00a0\u00a0\u00a0&lt;groupId&gt;log4j&lt;\/groupId&gt;\n\u00a0\u00a0\u00a0\u00a0&lt;artifactId&gt;log4j&lt;\/artifactId&gt;\n\u00a0\u00a0\u00a0\u00a0&lt;version&gt;1.2.17&lt;\/version&gt;\n&lt;\/dependency&gt;<\/pre>\n<p>log4j.properties\uff0c\u5c06Log4j\u7684\u65e5\u5fd7\u8f93\u51fa\u5230<strong>SocketAppender<\/strong>\uff0c\u56e0\u4e3a\u5b98\u7f51\u662f\u8fd9\u4e48\u8bf4\u7684\uff1a<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/static.open-open.com\/lib\/uploadImg\/20160103\/20160103141218_304.png\" width=\"697\" height=\"237\" \/><\/p>\n<pre class=\"brush:java; toolbar: true; auto-links: false;\">log4j.rootLogger=INFO,console\n\n#\u00a0for\u00a0package\u00a0com.demo.elk,\u00a0log\u00a0would\u00a0be\u00a0sent\u00a0to\u00a0socket\u00a0appender.\nlog4j.logger.com.demo.elk=DEBUG,\u00a0socket\n\n#\u00a0appender\u00a0socket\nlog4j.appender.socket=org.apache.log4j.net.SocketAppender\nlog4j.appender.socket.Port=4567\nlog4j.appender.socket.RemoteHost=centos2\nlog4j.appender.socket.layout=org.apache.log4j.PatternLayout\nlog4j.appender.socket.layout.ConversionPattern=%d\u00a0[%-5p]\u00a0[%l]\u00a0%m%n\nlog4j.appender.socket.ReconnectionDelay=10000\n\n#\u00a0appender\u00a0console\nlog4j.appender.console=org.apache.log4j.ConsoleAppender\nlog4j.appender.console.target=System.out\nlog4j.appender.console.layout=org.apache.log4j.PatternLayout\nlog4j.appender.console.layout.ConversionPattern=%d\u00a0[%-5p]\u00a0[%l]\u00a0%m%n<\/pre>\n<p>\u6ce8\u610f\uff1a<strong>\u8fd9\u91cc\u7684\u7aef\u53e3\u53f7\u9700\u8981\u8ddfLogstash\u76d1\u542c\u7684\u7aef\u53e3\u53f7\u4e00\u81f4\uff0c\u8fd9\u91cc\u662f4567\u3002<\/strong><\/p>\n<p>Application.java\uff0c\u4f7f\u7528Log4j\u7684LOGGER\u6253\u5370\u65e5\u5fd7\u5373\u53ef\uff1a<\/p>\n<pre class=\"brush:java; toolbar: true; auto-links: false;\">package\u00a0com.demo.elk;\n\nimport\u00a0org.apache.log4j.Logger;\n\npublic\u00a0class\u00a0Application\u00a0{\n\u00a0\u00a0\u00a0\u00a0private\u00a0static\u00a0final\u00a0Logger\u00a0LOGGER\u00a0=\u00a0Logger.getLogger(Application.class);\n\u00a0\u00a0\u00a0\u00a0public\u00a0static\u00a0void\u00a0main(String[]\u00a0args)\u00a0throws\u00a0Exception\u00a0{\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0for\u00a0(int\u00a0i\u00a0=\u00a00;\u00a0i\u00a0&lt;\u00a010;\u00a0i++)\u00a0{\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0LOGGER.error(\"Info\u00a0log\u00a0[\"\u00a0+\u00a0i\u00a0+\u00a0\"].\");\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Thread.sleep(500);\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\n\u00a0\u00a0\u00a0\u00a0}\n}<\/pre>\n<h4>\u7528Head\u63d2\u4ef6\u67e5\u770bES\u72b6\u6001\u548c\u5185\u5bb9<\/h4>\n<p>\u8fd0\u884cApplication.java\uff0c\u5148\u770b\u770bconsole\u7684\u8f93\u51fa\uff08\u5f53\u7136\uff0c\u8fd9\u4e2a\u8f93\u51fa\u53ea\u662f\u4e3a\u4e86\u505a\u9a8c\u8bc1\uff0c\u4e0d\u8f93\u51fa\u5230console\u4e5f\u53ef\u4ee5\u7684\uff09\uff1a<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/static.open-open.com\/lib\/uploadImg\/20160103\/20160103141218_346.png\" width=\"700\" height=\"180\" \/><\/p>\n<p>\u518d\u6765\u770b\u770bES\u7684head\u9875\u9762\uff1a<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/static.open-open.com\/lib\/uploadImg\/20160103\/20160103141218_81.png\" width=\"700\" height=\"297\" \/><\/p>\n<p>\u5207\u6362\u5230Browser\u6807\u7b7e\uff1a<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/static.open-open.com\/lib\/uploadImg\/20160103\/20160103141219_771.png\" width=\"700\" height=\"315\" \/><\/p>\n<p>\u5355\u51fb\u67d0\u4e00\u4e2a\u6587\u6863\uff08doc\uff09\uff0c\u5219\u4f1a\u5c55\u793a\u8be5\u6587\u6863\u7684\u6240\u6709\u4fe1\u606f\uff1a<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/static.open-open.com\/lib\/uploadImg\/20160103\/20160103141219_873.png\" width=\"502\" height=\"344\" \/><\/p>\n<p>\u53ef\u4ee5\u770b\u5230\uff0c\u9664\u4e86\u57fa\u7840\u7684message\u5b57\u6bb5\u662f\u6211\u4eec\u7684\u65e5\u5fd7\u5185\u5bb9\uff0cLogstash\u8fd8\u4e3a\u6211\u4eec\u589e\u52a0\u4e86\u8bb8\u591a\u5b57\u6bb5\u3002\u800c\u5728<a href=\"https:\/\/www.elastic.co\/guide\/en\/logstash\/current\/plugins-inputs-log4j.html\" target=\"_blank\" rel=\"nofollow noopener\">https:\/\/www.elastic.co\/guide\/en\/logstash\/current\/plugins-inputs-log4j.html<\/a>\u4e2d\u4e5f\u660e\u786e\u8bf4\u660e\u4e86\u8fd9\u4e00\u70b9\uff1a<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/static.open-open.com\/lib\/uploadImg\/20160103\/20160103141219_800.png\" width=\"700\" height=\"262\" \/><\/p>\n<p>\u4e0a\u9762\u4f7f\u7528\u4e86ES\u7684Head\u63d2\u4ef6\u89c2\u5bdf\u4e86ES\u96c6\u7fa4\u7684\u72b6\u6001\u548c\u6570\u636e\uff0c\u4f46\u8fd9\u53ea\u662f\u4e2a\u7b80\u5355\u7684\u7528\u4e8e\u8ddfES\u4ea4\u4e92\u7684\u9875\u9762\u800c\u5df2\uff0c\u5e76\u4e0d\u80fd\u751f\u6210\u62a5\u8868\u6216\u8005\u56fe\u8868\u4ec0\u4e48\u7684\uff0c\u63a5\u4e0b\u6765\u4f7f\u7528Kibana\u6765\u6267\u884c\u641c\u7d22\u5e76\u751f\u6210\u56fe\u8868\u3002<\/p>\n<h4><strong>Kibana<\/strong><\/h4>\n<p>\u914d\u7f6eKibana:<\/p>\n<pre class=\"brush:java; toolbar: true; auto-links: false;\">tar\u00a0-zxvf\u00a0kibana-4.3.0-linux-x86.tar.gz\ncd\u00a0kibana-4.3.0-linux-x86\nvi\u00a0config\/kibana.yml<\/pre>\n<p>\u4fee\u6539\u4ee5\u4e0b\u51e0\u9879\uff08\u7531\u4e8e\u662f\u5355\u673a\u7248\u7684\uff0c\u56e0\u6b64host\u7684\u503c\u4e5f\u53ef\u4ee5\u4f7f\u7528localhost\u6765\u4ee3\u66ff\uff0c\u8fd9\u91cc\u4ec5\u4ec5\u4f5c\u4e3a\u6f14\u793a\uff09\uff1a<\/p>\n<pre class=\"brush:java; toolbar: true; auto-links: false;\">server.port:\u00a05601\nserver.host:\u00a0\u201ccentos2\u201d\nelasticsearch.url:\u00a0http:\/\/centos2:9200\nkibana.index:\u00a0\u201c.kibana\u201d<\/pre>\n<p>\u542f\u52a8kibana\uff1a<\/p>\n<pre class=\"brush:java; toolbar: true; auto-links: false;\">.\/bin\/kibana<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/static.open-open.com\/lib\/uploadImg\/20160103\/20160103141219_298.png\" width=\"700\" height=\"190\" \/><\/p>\n<p>\u7528\u6d4f\u89c8\u5668\u6253\u5f00\u8be5\u5730\u5740\uff1a<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/static.open-open.com\/lib\/uploadImg\/20160103\/20160103141219_413.png\" width=\"700\" height=\"477\" \/><\/p>\n<p>\u4e3a\u4e86\u540e\u7eed\u4f7f\u7528Kibana\uff0c\u9700\u8981\u914d\u7f6e\u81f3\u5c11\u4e00\u4e2aIndex\u540d\u5b57\u6216\u8005Pattern\uff0c\u5b83\u7528\u4e8e\u5728\u5206\u6790\u65f6\u786e\u5b9aES\u4e2d\u7684Index\u3002\u8fd9\u91cc\u6211\u8f93\u5165\u4e4b\u524d\u914d\u7f6e\u7684Index\u540d\u5b57applog\uff0cKibana\u4f1a\u81ea\u52a8\u52a0\u8f7d\u8be5Index\u4e0bdoc\u7684field\uff0c\u5e76\u81ea\u52a8\u9009\u62e9\u5408\u9002\u7684field\u7528\u4e8e\u56fe\u6807\u4e2d\u7684\u65f6\u95f4\u5b57\u6bb5\uff1a<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/static.open-open.com\/lib\/uploadImg\/20160103\/20160103141219_909.png\" width=\"700\" height=\"465\" \/><\/p>\n<p>\u70b9\u51fbCreate\u540e\uff0c\u53ef\u4ee5\u770b\u5230\u5de6\u4fa7\u589e\u52a0\u4e86\u914d\u7f6e\u7684Index\u540d\u5b57\uff1a<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/static.open-open.com\/lib\/uploadImg\/20160103\/20160103141220_750.png\" width=\"700\" height=\"417\" \/><\/p>\n<p>\u63a5\u4e0b\u6765\u5207\u6362\u5230Discover\u6807\u7b7e\u4e0a\uff0c\u6ce8\u610f\u53f3\u4e0a\u89d2\u662f\u67e5\u8be2\u7684\u65f6\u95f4\u8303\u56f4\uff0c\u5982\u679c\u6ca1\u6709\u67e5\u627e\u5230\u6570\u636e\uff0c\u90a3\u4e48\u4f60\u5c31\u53ef\u80fd\u9700\u8981\u8c03\u6574\u8fd9\u4e2a\u65f6\u95f4\u8303\u56f4\u4e86\uff0c\u8fd9\u91cc\u6211\u9009\u62e9Today\uff1a<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/static.open-open.com\/lib\/uploadImg\/20160103\/20160103141220_751.png\" width=\"700\" height=\"370\" \/><\/p>\n<p>\u63a5\u4e0b\u6765\u5c31\u80fd\u770b\u5230ES\u4e2d\u7684\u6570\u636e\u4e86\uff1a<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/static.open-open.com\/lib\/uploadImg\/20160103\/20160103141220_130.png\" width=\"700\" height=\"460\" \/><\/p>\n<p>\u6267\u884c\u641c\u7d22\u770b\u770b\u5462\uff1a<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/static.open-open.com\/lib\/uploadImg\/20160103\/20160103141221_221.png\" width=\"700\" height=\"457\" \/><\/p>\n<p>\u70b9\u51fb\u53f3\u8fb9\u7684\u4fdd\u5b58\u6309\u94ae\uff0c\u4fdd\u5b58\u8be5\u67e5\u8be2\u4e3asearch_all_logs\u3002\u63a5\u4e0b\u6765\u53bbVisualize\u9875\u9762\uff0c\u70b9\u51fb\u65b0\u5efa\u4e00\u4e2a\u67f1\u72b6\u56fe\uff08Vertical Bar Chart\uff09\uff0c\u7136\u540e\u9009\u62e9\u521a\u521a\u4fdd\u5b58\u7684\u67e5\u8be2search_all_logs\uff0c\u4e4b\u540e\uff0cKibana\u5c06\u751f\u6210\u7c7b\u4f3c\u4e8e\u4e0b\u56fe\u7684\u67f1\u72b6\u56fe\uff08\u53ea\u670910\u6761\u65e5\u5fd7\uff0c\u800c\u4e14\u662f\u5728\u540c\u4e00\u65f6\u95f4\u6bb5\u7684\uff0c\u6bd4\u8f83\u4e11\uff0c\u4f46\u8db3\u53ef\u4ee5\u8bf4\u660e\u95ee\u9898\u4e86\uff1a) \u00a0\uff09\uff1a<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/static.open-open.com\/lib\/uploadImg\/20160103\/20160103141221_11.png\" width=\"700\" height=\"459\" \/><\/p>\n<p>\u4f60\u53ef\u4ee5\u5728\u5de6\u8fb9\u8bbe\u7f6e\u56fe\u5f62\u7684\u5404\u9879\u53c2\u6570\uff0c\u70b9\u51fbApply Changes\u6309\u94ae\uff0c\u53f3\u8fb9\u7684\u56fe\u5f62\u5c06\u88ab\u66f4\u65b0\u3002\u540c\u7406\uff0c\u5176\u4ed6\u7c7b\u578b\u7684\u56fe\u5f62\u90fd\u53ef\u4ee5\u5b9e\u65f6\u66f4\u65b0\u3002<\/p>\n<p>\u70b9\u51fb\u53f3\u8fb9\u7684\u4fdd\u5b58\uff0c\u4fdd\u5b58\u6b64\u56fe\uff0c\u547d\u540d\u4e3asearch_all_logs_visual\u3002\u63a5\u4e0b\u6765\u5207\u6362\u5230Dashboard\u9875\u9762\uff1a<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/static.open-open.com\/lib\/uploadImg\/20160103\/20160103141221_447.png\" width=\"700\" height=\"237\" \/><\/p>\n<p>\u5355\u51fb\u65b0\u5efa\u6309\u94ae\uff0c\u9009\u62e9\u521a\u521a\u4fdd\u5b58\u7684search_all_logs_visual\u56fe\u5f62\uff0c\u9762\u677f\u4e0a\u5c06\u5c55\u793a\u8be5\u56fe\uff1a<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/static.open-open.com\/lib\/uploadImg\/20160103\/20160103141221_656.png\" width=\"700\" height=\"373\" \/><\/p>\n<p>\u5982\u679c\u6709\u8f83\u591a\u6570\u636e\uff0c\u6211\u4eec\u53ef\u4ee5\u6839\u636e\u4e1a\u52a1\u9700\u6c42\u548c\u5173\u6ce8\u70b9\u5728Dashboard\u9875\u9762\u6dfb\u52a0\u591a\u4e2a\u56fe\u8868\uff1a\u67f1\u5f62\u56fe\uff0c\u6298\u7ebf\u56fe\uff0c\u5730\u56fe\uff0c\u997c\u56fe\u7b49\u7b49\u3002\u5f53\u7136\uff0c\u6211\u4eec\u53ef\u4ee5\u8bbe\u7f6e\u66f4\u65b0\u9891\u7387\uff0c\u8ba9\u56fe\u8868\u81ea\u52a8\u66f4\u65b0\uff1a<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/static.open-open.com\/lib\/uploadImg\/20160103\/20160103141221_322.png\" width=\"700\" height=\"216\" \/><\/p>\n<p>\u5982\u679c\u8bbe\u7f6e\u7684\u65f6\u95f4\u95f4\u9694\u591f\u77ed\uff0c\u5c31\u5f88\u8d8b\u8fd1\u4e8e\u5b9e\u65f6\u5206\u6790\u4e86\u3002<\/p>\n<p>\u5230\u8fd9\u91cc\uff0cELK\u5e73\u53f0\u90e8\u7f72\u548c\u57fa\u672c\u7684\u6d4b\u8bd5\u5df2\u5b8c\u6210\u3002<\/p>\n<p>\u53c2\u8003\uff1a<\/p>\n<p><a href=\"http:\/\/baidu.blog.51cto.com\/71938\/1676798\" rel=\"nofollow\">http:\/\/baidu.blog.51cto.com\/71938\/1676798<\/a><\/p>\n<p><a href=\"http:\/\/blog.csdn.net\/cnweike\/article\/details\/33736429\" rel=\"nofollow\">http:\/\/blog.csdn.net\/cnweike\/article\/details\/33736429<\/a><\/p>\n<p>\u6765\u81ea\uff1a\u00a0<a href=\"http:\/\/my.oschina.net\/itblog\/blog\/547250\" target=\"_blank\" rel=\"nofollow noopener\">http:\/\/my.oschina.net\/itblog\/blog\/547250<\/a><\/p>\n<h2 id=\"articleHeader2\"><strong>\u6269\u5c55\u9605\u8bfb<\/strong><\/h2>\n<p><a title=\"\u4f7f\u7528ELK(Elasticsearch\" href=\"http:\/\/www.open-open.com\/lib\/view\/open1441088477784.html\"><span class=\"title\">\u4f7f\u7528ELK(Elasticsearch + Logstash + Kibana) \u642d\u5efa\u65e5\u5fd7\u96c6\u4e2d\u5206\u6790\u5e73\u53f0\u5b9e\u8df5<\/span><\/a><br \/>\n<a title=\"\u65b0\u6d6a\u662f\u5982\u4f55\u5206\u6790\u5904\u740632\u4ebf\u6761\u5b9e\u65f6\u65e5\u5fd7\u7684\uff1f\" href=\"http:\/\/www.open-open.com\/lib\/view\/open1437018728240.html\"><span class=\"title\">\u65b0\u6d6a\u662f\u5982\u4f55\u5206\u6790\u5904\u740632\u4ebf\u6761\u5b9e\u65f6\u65e5\u5fd7\u7684\uff1f\u00a0<\/span><\/a><br \/>\n<a title=\"\u4f7f\u7528Elasticsearch\" href=\"http:\/\/www.open-open.com\/lib\/view\/open1446009380960.html\"><span class=\"title\">\u4f7f\u7528Elasticsearch + Logstash + Kibana\u642d\u5efa\u65e5\u5fd7\u96c6\u4e2d\u5206\u6790\u5e73\u53f0\u5b9e\u8df5<\/span><\/a><br \/>\n<a title=\"Logstash\u5b9e\u8df5:\" href=\"http:\/\/www.open-open.com\/lib\/view\/open1451353236980.html\"><span class=\"title\">Logstash\u5b9e\u8df5: \u5206\u5e03\u5f0f\u7cfb\u7edf\u7684\u65e5\u5fd7\u76d1\u63a7<\/span><\/a><br \/>\n<a title=\"\u7231\u5947\u827a\u57fa\u4e8e\" href=\"http:\/\/www.open-open.com\/lib\/view\/open1469020553456.html\"><span class=\"title\">\u7231\u5947\u827a\u57fa\u4e8e Docker \u7684 App Engine \u5b9e\u8df5<\/span><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>ELK\u5e73\u53f0\u4ecb\u7ecd \u5728\u641c\u7d22ELK\u8d44\u6599\u7684\u65f6\u5019\uff0c\u53d1\u73b0\u8fd9\u7bc7\u6587\u7ae0\u6bd4\u8f83\u597d\uff0c\u4e8e\u662f\u6458\u6284\u4e00\u5c0f\u6bb5\uff1a \u4ee5\u4e0b\u5185\u5bb9\u6765\u81ea\uff1ahttp:\/\/baidu.blog.51cto.com\/71938\/1676798 \u65e5\u5fd7\u4e3b\u8981\u5305\u62ec\u7cfb\u7edf\u65e5\u5fd7\u3001\u5e94\u7528\u7a0b\u5e8f\u65e5\u5fd7\u548c\u5b89\u5168\u65e5\u5fd7\u3002\u7cfb\u7edf\u8fd0\u7ef4\u548c\u5f00\u53d1\u4eba\u5458\u53ef\u4ee5\u901a\u8fc7\u65e5\u5fd7\u4e86\u89e3\u670d\u52a1\u5668\u8f6f\u786c\u4ef6\u4fe1\u606f\u3001\u68c0\u67e5\u914d\u7f6e\u8fc7\u7a0b\u4e2d\u7684\u9519\u8bef\u53ca\u9519\u8bef\u53d1\u751f\u7684\u539f\u56e0\u3002\u7ecf\u5e38\u5206\u6790\u65e5\u5fd7\u53ef\u4ee5\u4e86\u89e3\u670d\u52a1\u5668\u7684\u8d1f\u8377\uff0c\u6027\u80fd\u5b89\u5168\u6027\uff0c\u4ece\u800c\u53ca\u65f6\u91c7\u53d6\u63aa\u65bd\u7ea0\u6b63\u9519\u8bef\u3002 \u901a\u5e38\uff0c\u65e5\u5fd7\u88ab\u5206\u6563\u7684\u50a8\u5b58\u4e0d\u540c\u7684\u8bbe\u5907\u4e0a\u3002\u5982\u679c\u4f60\u7ba1\u7406\u6570\u5341\u4e0a\u767e\u53f0\u670d\u52a1\u5668\uff0c\u4f60\u8fd8\u5728\u4f7f\u7528\u4f9d\u6b21\u767b\u5f55\u6bcf\u53f0\u673a\u5668\u7684\u4f20\u7edf\u65b9\u6cd5\u67e5\u9605\u65e5\u5fd7\u3002\u8fd9\u6837\u662f\u4e0d\u662f\u611f\u89c9\u5f88\u7e41\u7410\u548c\u6548\u7387\u4f4e\u4e0b\u3002\u5f53\u52a1\u4e4b\u6025\u6211\u4eec\u4f7f\u7528\u96c6\u4e2d\u5316\u7684\u65e5\u5fd7\u7ba1\u7406\uff0c\u4f8b\u5982\uff1a\u5f00\u6e90\u7684syslog\uff0c\u5c06\u6240\u6709\u670d\u52a1\u5668\u4e0a\u7684\u65e5\u5fd7\u6536\u96c6\u6c47\u603b\u3002 \u96c6\u4e2d\u5316\u7ba1\u7406\u65e5\u5fd7\u540e\uff0c\u65e5\u5fd7\u7684\u7edf\u8ba1\u548c\u68c0\u7d22\u53c8\u6210\u4e3a\u4e00\u4ef6\u6bd4\u8f83\u9ebb\u70e6\u7684\u4e8b\u60c5\uff0c\u4e00\u822c\u6211\u4eec\u4f7f\u7528grep\u3001awk\u548cwc\u7b49Linux\u547d\u4ee4\u80fd\u5b9e\u73b0\u68c0\u7d22\u548c\u7edf\u8ba1\uff0c\u4f46\u662f\u5bf9\u4e8e\u8981\u6c42\u66f4\u9ad8\u7684\u67e5\u8be2\u3001\u6392\u5e8f\u548c\u7edf\u8ba1\u7b49\u8981\u6c42\u548c\u5e9e\u5927\u7684\u673a\u5668\u6570\u91cf\u4f9d\u7136\u4f7f\u7528\u8fd9\u6837\u7684\u65b9\u6cd5\u96be\u514d\u6709\u70b9\u529b\u4e0d\u4ece\u5fc3\u3002 \u5f00\u6e90\u5b9e\u65f6\u65e5\u5fd7\u5206\u6790ELK\u5e73\u53f0\u80fd\u591f\u5b8c\u7f8e\u7684\u89e3\u51b3\u6211\u4eec\u4e0a\u8ff0\u7684\u95ee\u9898\uff0cELK\u7531ElasticSearch\u3001Logstash\u548cKiabana\u4e09\u4e2a\u5f00\u6e90\u5de5\u5177\u7ec4\u6210\u3002\u5b98\u65b9\u7f51\u7ad9\uff1ahttps:\/\/www.elastic.co\/products Elasticsearch\u662f\u4e2a\u5f00\u6e90\u5206\u5e03\u5f0f\u641c\u7d22\u5f15\u64ce\uff0c\u5b83\u7684\u7279\u70b9\u6709\uff1a\u5206\u5e03\u5f0f\uff0c\u96f6\u914d\u7f6e\uff0c\u81ea\u52a8\u53d1\u73b0\uff0c\u7d22\u5f15\u81ea\u52a8\u5206\u7247\uff0c\u7d22\u5f15\u526f\u672c\u673a\u5236\uff0crestful\u98ce\u683c\u63a5\u53e3\uff0c\u591a\u6570\u636e\u6e90\uff0c\u81ea\u52a8\u641c\u7d22\u8d1f\u8f7d\u7b49\u3002 Logstash\u662f\u4e00\u4e2a\u5b8c\u5168\u5f00\u6e90\u7684\u5de5\u5177\uff0c\u4ed6\u53ef\u4ee5\u5bf9\u4f60\u7684\u65e5\u5fd7\u8fdb\u884c\u6536\u96c6\u3001\u8fc7\u6ee4\uff0c\u5e76\u5c06\u5176\u5b58\u50a8\u4f9b\u4ee5\u540e\u4f7f\u7528\uff08\u5982\uff0c\u641c\u7d22\uff09\u3002 Kibana \u4e5f\u662f\u4e00\u4e2a\u5f00\u6e90\u548c\u514d\u8d39\u7684\u5de5\u5177\uff0c\u5b83Kibana\u53ef\u4ee5\u4e3a Logstash \u548c ElasticSearch \u63d0\u4f9b\u7684\u65e5\u5fd7\u5206\u6790\u53cb\u597d\u7684 Web \u754c\u9762\uff0c\u53ef\u4ee5\u5e2e\u52a9\u60a8\u6c47\u603b\u3001\u5206\u6790\u548c\u641c\u7d22\u91cd\u8981\u6570\u636e\u65e5\u5fd7\u3002 &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-\u6458\u6284\u5185\u5bb9\u7ed3\u675f&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;- \u753b\u4e86\u4e00\u4e2aELK\u5de5\u4f5c\u7684\u539f\u7406\u56fe\uff1a \u5982\u56fe\uff1aLogstash\u6536\u96c6AppServer\u4ea7\u751f\u7684Log\uff0c\u5e76\u5b58\u653e\u5230ElasticSearch\u96c6\u7fa4\u4e2d\uff0c\u800cKibana\u5219\u4eceES\u96c6\u7fa4\u4e2d\u67e5\u8be2\u6570\u636e\u751f\u6210\u56fe\u8868\uff0c\u518d\u8fd4\u56de\u7ed9Browser\u3002 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[1],"tags":[],"class_list":["post-394","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=\/wp\/v2\/posts\/394","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=394"}],"version-history":[{"count":0,"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=\/wp\/v2\/posts\/394\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=394"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=394"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=394"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}