{"id":33364,"date":"2026-09-22T10:00:00","date_gmt":"2026-09-22T02:00:00","guid":{"rendered":"https:\/\/cn.hostease.com\/blog\/?p=33364"},"modified":"2026-09-23T12:58:10","modified_gmt":"2026-09-23T04:58:10","slug":"server-graylog-deployment","status":"publish","type":"post","link":"https:\/\/cn.hostease.com\/blog\/guides\/server-graylog-deployment\/","title":{"rendered":"\u591a\u670d\u52a1\u5668\u65e5\u5fd7\u96c6\u4e2d\u7ba1\u7406\uff1aGraylog \u6536\u96c6\u4e0e\u68c0\u7d22\u90e8\u7f72"},"content":{"rendered":"<p>\u5982\u679c\u4f60\u540c\u65f6\u7ef4\u62a4\u51e0\u5341\u53f0\u670d\u52a1\u5668\uff0c\u4e00\u5b9a\u9047\u5230\u8fc7\u8fd9\u6837\u7684\u573a\u666f\uff1a\u7f51\u7ad9\u7a81\u7136\u62a5 500 \u9519\u8bef\uff0c\u4f60\u6328\u4e2a\u767b\u5f55\u673a\u5668\uff0c\u7528 grep \u5728\u4e0d\u540c\u8def\u5f84\u91cc\u7ffb\u65e5\u5fd7\uff0c\u7b49\u627e\u5230\u62a5\u9519\u884c\uff0c\u7528\u6237\u5df2\u7ecf\u6295\u8bc9\u4e86\u534a\u5c0f\u65f6\u3002\u8fd9\u5c31\u662f\u65e5\u5fd7\u5206\u6563\u7684\u5178\u578b\u75db\u70b9\u2014\u2014\u5982\u4f55\u628a\u6563\u843d\u5728\u591a\u53f0\u670d\u52a1\u5668\u4e0a\u7684\u65e5\u5fd7\u96c6\u4e2d\u5230\u4e00\u5904\uff0c\u5e76\u4e14\u80fd\u50cf\u641c\u7d22\u5f15\u64ce\u4e00\u6837\u5feb\u901f\u68c0\u7d22\uff1f\u672c\u6587\u4ee5\u5f00\u6e90\u7684 Graylog\uff08\u4e00\u6b3e\u96c6\u4e2d\u5f0f\u65e5\u5fd7\u7ba1\u7406\u5e73\u53f0\uff09\u4e3a\u4f8b\uff0c\u5e26\u4f60\u5b8c\u6210\u4ece\u90e8\u7f72\u3001\u6536\u96c6\u5230\u68c0\u7d22\u6392\u969c\u7684\u5b8c\u6574\u6d41\u7a0b\uff0c\u5e2e\u52a9\u4e2d\u5c0f\u56e2\u961f\u642d\u5efa\u81ea\u5df1\u53ef\u63a7\u7684\u65e5\u5fd7\u4f53\u7cfb\u3002<\/p>\n<p><!--more--><\/p>\n<h2>\u4e3a\u4ec0\u4e48\u591a\u670d\u52a1\u5668\u73af\u5883\u5fc5\u987b\u505a\u65e5\u5fd7\u96c6\u4e2d\u7ba1\u7406<\/h2>\n<p>\u5355\u53f0\u670d\u52a1\u5668\u65f6\u4ee3\uff0cSSH \u767b\u5f55\u540e\u76f4\u63a5\u770b <code>\/var\/log\/<\/code> \u5c31\u591f\u4e86\uff1b\u4f46\u670d\u52a1\u5668\u6570\u91cf\u4e00\u591a\uff0c\u9010\u53f0\u6392\u67e5\u4f1a\u8fc5\u901f\u5931\u63a7\u3002\u7b97\u4e00\u7b14\u65f6\u95f4\u8d26\uff1a\u4e00\u6b21\u6545\u969c\u5e73\u5747\u8981\u68c0\u67e5 5 \u53f0\u670d\u52a1\u5668\uff0c\u6bcf\u53f0\u767b\u5f55\u52a0\u5b9a\u4f4d\u65e5\u5fd7\u8017\u65f6 3 \u5206\u949f\uff0c\u4e00\u6b21\u6392\u969c\u5c31\u8981 15 \u5206\u949f\u8d77\u6b65\uff1b\u5982\u679c\u65e5\u5fd7\u8fd8\u5206\u6563\u5728\u5e94\u7528\u3001Nginx\u3001\u7cfb\u7edf\u65e5\u5fd7\u591a\u4e2a\u4f4d\u7f6e\uff0c\u65f6\u95f4\u4f1a\u7ffb\u500d\u3002\u96c6\u4e2d\u7ba1\u7406\u4e4b\u540e\uff0c\u4f60\u5728\u4e00\u4e2a\u641c\u7d22\u6846\u91cc\u8f93\u5165\u9519\u8bef\u5173\u952e\u8bcd\uff0c\u51e0\u79d2\u949f\u5c31\u80fd\u7b5b\u51fa\u6240\u6709\u76f8\u5173\u673a\u5668\u7684\u62a5\u9519\uff0c\u5b9a\u4f4d\u6548\u7387\u63d0\u5347\u901a\u5e38\u662f\u5341\u500d\u91cf\u7ea7\u3002<\/p>\n<p>\u9664\u4e86\u901f\u5ea6\uff0c\u96c6\u4e2d\u7ba1\u7406\u8fd8\u89e3\u51b3\u4e24\u4e2a\u9690\u853d\u95ee\u9898\u3002\u4e00\u662f\u7559\u5b58\uff1a\u5355\u673a\u65e5\u5fd7\u901a\u5e38\u53ea\u4fdd\u7559\u51e0\u5929\uff0c\u78c1\u76d8\u5199\u6ee1\u8fd8\u4f1a\u88ab\u81ea\u52a8\u6e05\u7406\uff0c\u4e8b\u540e\u65e0\u4ece\u56de\u6eaf\uff1b\u96c6\u4e2d\u5b58\u50a8\u628a\u65e5\u5fd7\u5bff\u547d\u5ef6\u957f\u5230 30 \u5929\u4ee5\u4e0a\uff0c\u6545\u969c\u590d\u76d8\u624d\u6709\u4f9d\u636e\u3002\u4e8c\u662f\u5173\u8054\u5206\u6790\uff1a\u4e00\u6b21\u8bf7\u6c42\u5f80\u5f80\u7ecf\u8fc7\u8d1f\u8f7d\u5747\u8861\u3001Web\u3001\u5e94\u7528\u591a\u5c42\uff0c\u53ea\u6709\u628a\u5404\u5c42\u65e5\u5fd7\u6309\u65f6\u95f4\u7ebf\u5bf9\u9f50\uff0c\u624d\u80fd\u770b\u51fa\u95ee\u9898\u51fa\u5728\u54ea\u4e00\u5c42\u3002<\/p>\n<p>\u6210\u672c\u7ed3\u6784\u987a\u5e26\u8bf4\u660e\u3002Graylog \u672c\u8eab\u662f\u5f00\u6e90\u8f6f\u4ef6\uff08Open \u7248\u514d\u8d39\uff09\uff0c\u5f00\u9500\u4e3b\u8981\u5728\u670d\u52a1\u5668\u548c\u5b58\u50a8\u3002\u65e5\u5fd7\u91cf\u6bcf\u5929\u51e0\u4e2a GB \u4ee5\u5185\u7684\u56e2\u961f\uff0c\u4e00\u53f0 4 \u6838 8GB \u7684 <a href=\"https:\/\/cn.hostease.com\/vps\/\">VPS<\/a>\uff08<a href=\"https:\/\/cn.hostease.com\/vps\/\">\u865a\u62df\u4e13\u7528\u670d\u52a1\u5668<\/a>\uff09\u52a0 100GB \u78c1\u76d8\u5373\u53ef\u652f\u6491\u5165\u95e8\u5e73\u53f0\uff0c\u4ef7\u683c\u622a\u81f3 2026 \u5e74 9 \u6708\u7ea6\u6bcf\u6708\u51e0\u5341\u7f8e\u5143\uff08\u4ee5\u5b98\u7f51\u5b9e\u65f6\u4ef7\u683c\u4e3a\u51c6\uff09\uff0c\u8fdc\u4f4e\u4e8e\u6309\u6761\u8ba1\u8d39\u7684\u5546\u4e1a\u670d\u52a1\u3002<\/p>\n<p>\u90e8\u7f72\u524d\u5148\u7406\u89e3\u4e09\u4e2a\u6838\u5fc3\u7ec4\u4ef6\uff1aGraylog Server \u662f\u5e73\u53f0\u5927\u8111\uff0c\u8d1f\u8d23\u63a5\u6536\u65e5\u5fd7\u3001\u89e3\u6790\u5b57\u6bb5\u548c\u54cd\u5e94\u68c0\u7d22\uff1bOpenSearch \u662f\u5e95\u5c42\u641c\u7d22\u5f15\u64ce\uff0c\u6240\u6709\u65e5\u5fd7\u4ee5\u7d22\u5f15\u5f62\u5f0f\u5b58\u5728\u5176\u4e2d\uff0c\u68c0\u7d22\u901f\u5ea6\u53d6\u51b3\u4e8e\u5b83\u7684\u5185\u5b58\u548c\u78c1\u76d8\uff0c\u5b98\u65b9\u8981\u6c42\u5806\u5185\u5b58\u81f3\u5c11 4GB\uff1bMongoDB \u53ea\u5b58\u7528\u6237\u3001\u4eea\u8868\u76d8\u7b49\u914d\u7f6e\uff0c\u4e0d\u5b58\u65e5\u5fd7\u672c\u4f53\u3002\u65e5\u5e38\u67e5\u8be2\u7531 Graylog Server \u8f6c\u7ed9 OpenSearch \u6267\u884c\uff0c\u56e0\u6b64\u65e5\u5fd7\u670d\u52a1\u5668\u7684\u914d\u7f6e\u6700\u9700\u8981\u4fdd\u8bc1\u3002<\/p>\n<p>\u90e8\u7f72\u524d\u51c6\u5907\u5f88\u7b80\u5355\uff1a\u4e00\u53f0 Ubuntu 22.04 \u6216 Debian 12 \u673a\u5668\uff08\u72ec\u7acb<a href=\"https:\/\/cn.hostease.com\/vps\/\">\u4e91\u4e3b\u673a<\/a>\u5373\u53ef\uff09\uff0c\u5f00\u653e 9000\uff08Web \u754c\u9762\uff09\u548c 1514\uff08\u65e5\u5fd7\u63a5\u6536\uff09\u7aef\u53e3\uff0c\u4e1a\u52a1\u670d\u52a1\u5668\u4e0e\u65e5\u5fd7\u670d\u52a1\u5668\u7f51\u7edc\u4e92\u901a\uff0c\u5907\u597d sudo \u8d26\u53f7\u3002\u7248\u672c\u5efa\u8bae\u76f4\u63a5\u7528 Graylog 6.x + OpenSearch 2.x \u5b98\u65b9\u63a8\u8350\u7ec4\u5408\uff0c\u4e0d\u8981\u6df7\u7528\u65e7\u7248\u672c\u53f7\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/cn.hostease.com\/blog\/wp-content\/uploads\/2026\/09\/server-graylog-deployment-cover.webp\" alt=\"\u591a\u670d\u52a1\u5668\u65e5\u5fd7\u901a\u8fc7\u7f51\u7edc\u96c6\u4e2d\u6c47\u5165 Graylog \u65e5\u5fd7\u5e73\u53f0\u7684\u793a\u610f\u56fe\" loading=\"lazy\" \/><\/p>\n<h2>Graylog \u90e8\u7f72\u6b65\u9aa4\uff1a\u4ece\u7a7a\u673a\u5668\u5230\u53ef\u767b\u5f55\u7684 Web \u754c\u9762<\/h2>\n<p>\u4e0b\u9762\u4ee5 Ubuntu 22.04 \u4e3a\u4f8b\u8d70\u4e00\u904d\u5b8c\u6574\u6d41\u7a0b\u3002\u6240\u6709\u547d\u4ee4\u90fd\u9488\u5bf9\u65e5\u5fd7\u670d\u52a1\u5668\u672c\u673a\u6267\u884c\uff0c\u6574\u4e2a\u8fc7\u7a0b\u5927\u7ea6 20 \u5206\u949f\u3002<\/p>\n<p>\u7b2c\u4e00\u6b65\uff0c\u5b89\u88c5\u57fa\u7840\u8f6f\u4ef6\u5305\u3002OpenSearch \u548c MongoDB \u9700\u8981\u5148\u5bfc\u5165\u5b98\u65b9 GPG \u5bc6\u94a5\u518d\u914d\u7f6e apt \u6e90\uff0cGraylog \u540c\u7406\u3002\u4ee5 sudo \u7528\u6237\u6267\u884c\uff1a<\/p>\n<pre><code class=\"language-bash\"># \u5b89\u88c5 MongoDB\uff08Graylog \u914d\u7f6e\u5b58\u50a8\uff09\napt-get update &amp;&amp; apt-get install -y mongodb-org curl\n\n# \u5b89\u88c5 OpenSearch\uff08\u65e5\u5fd7\u7d22\u5f15\u5f15\u64ce\uff09\ncurl -o opensearch-2.19.1-linux-x64.tar.gz https:\/\/artifacts.opensearch.org\/releases\/bundle\/opensearch\/2.19.1\/opensearch-2.19.1-linux-x64.tar.gz\ntar -xzf opensearch-2.19.1-linux-x64.tar.gz -C \/opt\/\n<\/code><\/pre>\n<p>\u7b2c\u4e8c\u6b65\uff0c\u8c03\u6574 OpenSearch \u7684\u5173\u952e\u53c2\u6570\u3002JVM \u5806\u5185\u5b58\u5efa\u8bae\u8bbe\u4e3a\u7269\u7406\u5185\u5b58\u7684\u4e00\u534a\u4e14\u4e0d\u8d85\u8fc7 8GB\uff1b\u5355\u673a\u90e8\u7f72\u8fd8\u9700\u8981\u663e\u5f0f\u5173\u95ed\u5b89\u5168\u63d2\u4ef6\u7684\u5f3a\u5236\u9650\u5236\uff0c\u5426\u5219\u670d\u52a1\u8d77\u4e0d\u6765\uff1a<\/p>\n<pre><code class=\"language-bash\"># JVM \u5806\u5185\u5b58\uff088GB \u5185\u5b58\u673a\u5668\u793a\u4f8b\uff09\nexport OPENSEARCH_JAVA_HOME=\/opt\/opensearch\/jdk\necho &quot;-Xms4g&quot; &gt;&gt; \/opt\/opensearch\/config\/jvm.options\necho &quot;-Xmx4g&quot; &gt;&gt; \/opt\/opensearch\/config\/jvm.options\n\n# \u5355\u673a\u90e8\u7f72\u653e\u5f00\u6f14\u793a\u914d\u7f6e\nsed -i 's\/plugins.security.ssl.http.enabled: true\/plugins.security.ssl.http.enabled: false\/' \/opt\/opensearch\/config\/opensearch.yml\necho &quot;plugins.security.ssl.http.enabled: false&quot; &gt;&gt; \/opt\/opensearch\/config\/opensearch.yml\necho &quot;discovery.type: single-node&quot; &gt;&gt; \/opt\/opensearch\/config\/opensearch.yml\n<\/code><\/pre>\n<p>\u7b2c\u4e09\u6b65\uff0c\u5b89\u88c5 Graylog \u672c\u4f53\u5e76\u5199\u5165\u6838\u5fc3\u914d\u7f6e\u3002\u8fd9\u91cc\u6709\u4e24\u4e2a\u5fc5\u586b\u9879\uff1a<code>password_secret<\/code> \u662f\u5e73\u53f0\u5185\u90e8\u52a0\u5bc6\u76d0\uff0c<code>root_password_sha2<\/code> \u662f\u7ba1\u7406\u5458\u5bc6\u7801\u7684 SHA256 \u503c\uff0c\u4e24\u8005\u90fd\u5fc5\u987b\u663e\u5f0f\u8bbe\u7f6e\uff0c\u5426\u5219 Graylog \u65e0\u6cd5\u542f\u52a8\uff1a<\/p>\n<pre><code class=\"language-bash\">apt-get install -y graylog-server\n\n# \u751f\u6210\u7ba1\u7406\u5458\u5bc6\u7801\u54c8\u5e0c\uff08\u628a YourPassword \u6362\u6210\u4f60\u7684\u5b9e\u9645\u5bc6\u7801\uff09\necho -n &quot;YourPassword&quot; | sha256sum\n\n# \u7f16\u8f91 \/etc\/graylog\/server\/server.conf\uff0c\u81f3\u5c11\u586b\u5199\uff1a\n# password_secret = 64\u4f4d\u4ee5\u4e0a\u968f\u673a\u5b57\u7b26\u4e32\uff08\u7528 pwgen -N 1 -s 96 \u751f\u6210\uff09\n# root_password_sha2 = \u4e0a\u9762\u547d\u4ee4\u8f93\u51fa\u7684\u54c8\u5e0c\u503c\n# http_bind_address = 0.0.0.0:9000\n# elasticsearch_hosts = http:\/\/127.0.0.1:9200\n# mongodb_uri = mongodb:\/\/127.0.0.1:27017\/graylog\n<\/code><\/pre>\n<p>\u7b2c\u56db\u6b65\uff0c\u6309 MongoDB \u2192 OpenSearch \u2192 Graylog \u7684\u987a\u5e8f\u542f\u52a8\u670d\u52a1\uff0c\u7528 <code>systemctl status<\/code> \u786e\u8ba4\u4e09\u4e2a\u670d\u52a1\u90fd\u662f active\u3002\u6d4f\u89c8\u5668\u8bbf\u95ee <code>http:\/\/\u65e5\u5fd7\u670d\u52a1\u5668IP:9000<\/code>\uff0c\u770b\u5230\u767b\u5f55\u9875\u5373\u90e8\u7f72\u6210\u529f\uff0c\u9ed8\u8ba4\u8d26\u53f7\u662f admin\u3002<\/p>\n<p>\u9ad8\u9891\u8e29\u5751\u70b9\uff1a\u5185\u5b58\u4e0d\u8db3\u5bfc\u81f4 OpenSearch \u53cd\u590d\u91cd\u542f\uff08\u65e5\u5fd7\u51fa\u73b0 &#8220;heap size too large&#8221;\uff09\uff0c\u628a\u5806\u5185\u5b58\u8c03\u5230\u7269\u7406\u5185\u5b58\u4e00\u534a\u4ee5\u5185\uff1b\u9632\u706b\u5899\u53ea\u653e\u884c 9000 \u6ca1\u653e\u884c 1514\uff0c\u8868\u73b0\u4e3a\u754c\u9762\u6b63\u5e38\u4f46\u65e5\u5fd7\u6536\u4e0d\u5230\uff1b<code>password_secret<\/code> \u6df7\u5165\u7279\u6b8a\u5b57\u7b26\u5bfc\u81f4\u89e3\u6790\u5931\u8d25\uff0c\u7528\u7eaf\u5b57\u6bcd\u6570\u5b57 96 \u4f4d\u968f\u673a\u4e32\u6700\u7a33\u59a5\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/cn.hostease.com\/blog\/wp-content\/uploads\/2026\/09\/server-graylog-deployment-components.webp\" alt=\"Graylog \u4e09\u5927\u7ec4\u4ef6\u5206\u5de5\u793a\u610f\u56fe\" loading=\"lazy\" \/><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/cn.hostease.com\/blog\/wp-content\/uploads\/2026\/09\/server-graylog-deployment-flow.webp\" alt=\"Graylog \u90e8\u7f72\u56db\u6b65\u6d41\u7a0b\u793a\u610f\" loading=\"lazy\" \/><\/p>\n<h2>\u628a\u4e1a\u52a1\u670d\u52a1\u5668\u65e5\u5fd7\u63a5\u5165 Graylog<\/h2>\n<p>\u5e73\u53f0\u5c31\u7eea\u540e\uff0c\u4e0b\u4e00\u6b65\u662f\u8ba9\u4e1a\u52a1\u670d\u52a1\u5668\u7684\u65e5\u5fd7&#8221;\u6d41&#8221;\u8fdb\u6765\uff1a\u5728 Graylog \u7aef\u521b\u5efa\u63a5\u6536\u5165\u53e3\uff08Input\uff09\uff0c\u518d\u5728\u5404\u4e1a\u52a1<a href=\"https:\/\/cn.hostease.com\/blog\/server\/\">\u670d\u52a1\u5668\u914d\u7f6e<\/a>\u8f6c\u53d1\u5ba2\u6237\u7aef\u3002<\/p>\n<p>\u5148\u5728 Graylog \u754c\u9762\u521b\u5efa GELF \u8f93\u5165\u6e90\uff1a\u8fdb\u5165 System \u2192 Inputs\uff0c\u9009\u62e9 GELF TCP\uff08\u4fbf\u4e8e\u786e\u8ba4\u8fde\u63a5\u72b6\u6001\uff09\uff0c\u7ed1\u5b9a 12201 \u7aef\u53e3\u3002GELF \u662f Graylog \u539f\u751f\u683c\u5f0f\uff0c\u652f\u6301\u7ed3\u6784\u5316\u5b57\u6bb5\uff0c\u6bd4\u539f\u59cb syslog \u66f4\u5229\u4e8e\u6309\u5b57\u6bb5\u8fc7\u6ee4\u3002\u9632\u706b\u5899\u53ea\u5bf9\u5185\u7f51\u4e1a\u52a1\u670d\u52a1\u5668\u7f51\u6bb5\u5f00\u653e\u8be5\u7aef\u53e3\u3002<\/p>\n<p>\u5ba2\u6237\u7aef\u6700\u901a\u7528\u7684\u65b9\u6848\u662f Filebeat\uff08Elastic \u5b98\u65b9\u8f7b\u91cf\u8f6c\u53d1\u5668\uff09\uff0c\u6bcf\u53f0\u4e1a\u52a1\u670d\u52a1\u5668\u88c5\u4e00\u4e2a\uff0c\u5185\u5b58\u5360\u7528\u4e0d\u5230 50MB\u3002\u4ee5\u8f6c\u53d1 Nginx \u65e5\u5fd7\u4e3a\u4f8b\uff1a<\/p>\n<pre><code class=\"language-bash\"># \u4e1a\u52a1\u670d\u52a1\u5668\u4e0a\u5b89\u88c5 Filebeat \u540e\uff0c\u7f16\u8f91 \/etc\/filebeat\/filebeat.yml\nfilebeat.inputs:\n  - type: filestream\n    id: nginx-access\n    paths:\n      - \/var\/log\/nginx\/access.log\n    fields:\n      server_role: web\n      log_type: nginx_access\n\noutput.logstash:\n  hosts: [&quot;\u65e5\u5fd7\u670d\u52a1\u5668IP:5044&quot;]\n<\/code><\/pre>\n<p>Graylog \u7aef\u5bf9\u5e94\u521b\u5efa\u4e00\u4e2a Beats Input\uff08\u7aef\u53e3 5044\uff09\u5373\u53ef\u63a5\u6536\u3002\u5728\u4e1a\u52a1\u670d\u52a1\u5668\u6267\u884c <code>filebeat test output<\/code>\uff0c\u8fd4\u56de &#8220;connection to \u65e5\u5fd7\u670d\u52a1\u5668IP:5044 succeeded&#8221; \u8bf4\u660e\u94fe\u8def\u5df2\u901a\uff0cGraylog \u7684 Search \u9875\u9762\u51e0\u79d2\u5185\u5c31\u80fd\u770b\u5230\u65b0\u65e5\u5fd7\u3002<\/p>\n<p>\u4e3b\u8981\u6536\u96c6\u7cfb\u7edf\u65e5\u5fd7\u7684\u8bdd\uff0c\u4e5f\u53ef\u8d70\u66f4\u8f7b\u7684 Rsyslog \u8def\u7ebf\u2014\u2014\u5728 <code>\/etc\/rsyslog.d\/90-forward.conf<\/code> \u52a0\u4e00\u884c <code>*.* @\u65e5\u5fd7\u670d\u52a1\u5668IP:514<\/code>\uff0c\u91cd\u542f rsyslog \u5373\u53ef\u3002\u53d6\u820d\u660e\u786e\uff1aRsyslog \u96f6\u4f9d\u8d56\u4e00\u884c\u914d\u7f6e\uff0c\u9002\u5408\u7cfb\u7edf\u65e5\u5fd7\uff1bFilebeat \u6709\u65ad\u70b9\u7eed\u4f20\u548c\u5b57\u6bb5\u6807\u6ce8\uff0c\u9002\u5408\u5e94\u7528\u65e5\u5fd7\u3002<\/p>\n<p>\u9a8c\u8bc1\u6536\u96c6\u5b8c\u6574\u6027\u7684\u6280\u5de7\uff1a\u5728\u6bcf\u53f0\u4e1a\u52a1\u670d\u52a1\u5668\u6267\u884c <code>logger \"test-from-$(hostname)\"<\/code>\uff0c\u5230 Graylog \u641c\u7d22\u8fd9\u6761\u5173\u952e\u8bcd\uff0c\u6bcf\u53f0\u90fd\u51fa\u73b0\u8bf4\u660e\u65e0\u9057\u6f0f\uff1b\u7f3a\u54ea\u53f0\u5c31\u67e5\u90a3\u53f0\u7684\u5ba2\u6237\u7aef\u72b6\u6001\u548c\u7f51\u7edc\u3002\u66f4\u591a\u914d\u7f6e\u5dee\u5f02\u53ef\u53c2\u8003<a href=\"https:\/\/cn.hostease.com\/blog\/tutorials\/vps-deployment-troubleshooting-guide\/\">VPS \u90e8\u7f72\u6392\u969c\u6307\u5357<\/a>\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/cn.hostease.com\/blog\/wp-content\/uploads\/2026\/09\/server-graylog-deployment-collection.webp\" alt=\"\u65e5\u5fd7\u7ecf\u8f6c\u53d1\u5ba2\u6237\u7aef\u6c47\u5165 Graylog \u6536\u96c6\u7aef\u5e76\u89e6\u53d1\u544a\u8b66\u7684\u793a\u610f\" loading=\"lazy\" \/><\/p>\n<h2>\u7528\u68c0\u7d22\u548c\u544a\u8b66\u89e3\u51b3\u5b9e\u9645\u6392\u969c\u95ee\u9898<\/h2>\n<p>\u65e5\u5fd7\u6536\u8fdb\u6765\u540e\uff0c\u4ef7\u503c\u8981\u4ece\u68c0\u7d22\u5f00\u59cb\u4f53\u73b0\u3002Graylog \u641c\u7d22\u8bed\u6cd5\u63a5\u8fd1 Lucene\uff0c\u5e38\u7528\u7ec4\u5408\u51e0\u7c7b\uff1a\u6309\u6765\u6e90 <code>source:web-01<\/code>\uff0c\u6309\u7ea7\u522b <code>level:ERROR<\/code>\uff0c\u65f6\u95f4\u52a0\u5173\u952e\u8bcd &#8220;connection refused&#8221; AND timestamp:[now-1h TO now]\u3002\u591a\u6761\u4ef6 AND\/OR \u7ec4\u5408\u80fd\u8986\u76d6\u4e5d\u6210\u65e5\u5e38\u6392\u969c\u67e5\u8be2\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/cn.hostease.com\/blog\/wp-content\/uploads\/2026\/09\/server-graylog-deployment-search.webp\" alt=\"\u5728\u65e5\u5fd7\u7d22\u5f15\u4e2d\u68c0\u7d22\u5b9a\u4f4d\u9519\u8bef\u8bb0\u5f55\u7684\u793a\u610f\" loading=\"lazy\" \/><\/p>\n<p>\u4e3e\u4e2a\u771f\u5b9e\u4f8b\u5b50\uff1a\u7528\u6237\u53cd\u9988\u4e0b\u5355\u63a5\u53e3\u5076\u53d1\u8d85\u65f6\u3002\u6309\u6295\u8bc9\u65f6\u6bb5\u5708\u5b9a\u8303\u56f4\uff0c\u7528 <code>log_type:nginx_access AND response_time:&gt;3<\/code> \u7b5b\u51fa\u6162\u8bf7\u6c42\uff0c\u518d\u770b\u6765\u6e90 IP \u5206\u5e03\u2014\u2014\u96c6\u4e2d\u5728\u67d0\u673a\u623f\u662f\u7ebf\u8def\u95ee\u9898\uff1b\u5206\u6563\u4f46\u96c6\u4e2d\u5728\u67d0\u63a5\u53e3\u8def\u5f84\uff0c\u5c31\u7528\u8bf7\u6c42 ID \u5230\u5e94\u7528\u65e5\u5fd7\u4e32\u8054\u62a5\u9519\u3002\u5b9a\u4f4d\u901a\u5e38\u4e0d\u8d85\u8fc7\u5341\u5206\u949f\uff0c\u6b64\u524d\u540c\u6837\u7684\u6392\u67e5\u53ef\u80fd\u8981\u5728\u4e94\u516d\u53f0\u673a\u5668\u95f4\u5207\u6362\u534a\u5c0f\u65f6\u3002<\/p>\n<p>\u65e5\u5fd7\u96c6\u4e2d\u540e\u8fd8\u6709\u4e00\u5c42\u4ef7\u503c\uff1a\u8ba9\u544a\u8b66\u4e3b\u52a8\u627e\u4eba\u3002Graylog \u7684 Event Definition \u53ef\u4ee5\u5b9a\u4e49&#8221;\u641c\u7d22\u6761\u4ef6\u547d\u4e2d\u5373\u53d1\u9001\u901a\u77e5&#8221;\u3002\u4e24\u7c7b\u544a\u8b66\u503c\u5f97\u4f18\u5148\u914d\u7f6e\uff1a\u9519\u8bef\u7a81\u589e\uff0c\u540c\u4e00\u9519\u8bef\u5173\u952e\u8bcd 5 \u5206\u949f\u8d85 50 \u6b21\uff1b\u5b89\u5168\u7c7b\uff0cSSH \u8ba4\u8bc1\u5931\u8d25 10 \u5206\u949f\u8d85 20 \u6b21\uff08\u53ef\u5224\u5b9a\u4e3a\u66b4\u529b\u7834\u89e3\uff09\uff0c\u53ef\u914d\u5408<a href=\"https:\/\/cn.hostease.com\/blog\/guides\/dedicated-server-security-boundaries\/\">\u72ec\u7acb\u670d\u52a1\u5668\u7684\u5b89\u5168\u8fb9\u754c<\/a>\u89c4\u5212\u9632\u62a4\u5c42\u3002\u544a\u8b66\u6e20\u9053\u63a5\u5165\u56e2\u961f\u5728\u7528\u7684\u4f01\u4e1a\u5fae\u4fe1\u3001\u9489\u9489\u6216 Slack \u5373\u53ef\u3002<\/p>\n<p>\u5bb9\u91cf\u7ba1\u7406\u6709\u4e2a\u5751\uff1a\u78c1\u76d8\u5199\u6ee1\u540e OpenSearch \u8fdb\u5165\u53ea\u8bfb\uff0c\u65b0\u65e5\u5fd7\u5168\u90e8\u4e22\u5931\u4e14\u4e0d\u81ea\u52a8\u6062\u590d\u3002\u5efa\u8bae\u7d22\u5f15\u4fdd\u7559\u671f\u8bbe 15-30 \u5929\uff08System \u2192 Indices \u2192 Index Sets \u914d\u7f6e\uff09\uff0c\u5355\u72ec\u6302\u6570\u636e\u76d8\uff0c\u7528 <code>df -h<\/code> \u914d\u5408\u76d1\u63a7\u628a\u78c1\u76d8\u6c34\u4f4d\u63a7\u5236\u5728 80% \u4ee5\u4e0b\u3002Hostease \u7684 <a href=\"https:\/\/cn.hostease.com\/blog\/tutorials\/usa-vps-go-live-checklist-monitoring-backup\/\">\u7f8e\u56fd VPS<\/a> \u652f\u6301\u5355\u72ec\u6269\u5c55\u6570\u636e\u76d8\uff0c\u9002\u5408\u65e5\u5fd7\u5b58\u50a8\u8fd9\u7c7b\u5199\u5165\u9891\u7e41\u7684\u8d1f\u8f7d\u3002<\/p>\n<p>\u5e73\u53f0\u81ea\u8eab\u4e5f\u9700\u7ef4\u62a4\u3002\u78c1\u76d8 IO \u504f\u9ad8\u5148\u67e5\u7d22\u5f15\u5237\u65b0\u95f4\u9694\uff1b\u754c\u9762\u53d8\u6162\u591a\u4e3a OpenSearch \u5806\u5185\u5b58\u5403\u7d27\uff0c\u7528 <code>curl -XGET 'http:\/\/127.0.0.1:9200\/_cat\/nodes?v'<\/code> \u770b\u5185\u5b58\u6c34\u4f4d\u3002\u65e5\u5fd7\u4e0e\u6307\u6807\u3001\u94fe\u8def\u8ffd\u8e2a\u5982\u4f55\u914d\u5408\uff0c<a href=\"https:\/\/cn.hostease.com\/blog\/guides\/observability-for-small-hosting-teams\/\">\u4e2d\u5c0f\u56e2\u961f\u53ef\u89c2\u6d4b\u6027\u5b9e\u8df5<\/a> \u6709\u66f4\u5b8c\u6574\u7684\u6846\u67b6\u3002<\/p>\n<p>\u603b\u7ed3\uff1aGraylog \u7684\u4ef7\u503c\u5728\u4e8e\u628a&#8221;\u767b\u5f55 N \u53f0\u673a\u5668\u7ffb\u65e5\u5fd7&#8221;\u7684\u4e32\u884c\u6392\u67e5\uff0c\u53d8\u6210&#8221;\u4e00\u4e2a\u641c\u7d22\u6846\u5b9a\u4f4d\u5168\u90e8&#8221;\u7684\u5e76\u884c\u68c0\u7d22\u3002\u90e8\u7f72\u8bb0\u4f4f\u7ec4\u4ef6\u5206\u5de5\u548c\u5185\u5b58\u914d\u6bd4\uff0c\u63a5\u5165\u6309&#8221;\u5148\u7cfb\u7edf\u3001\u540e\u5e94\u7528&#8221;\u63a8\u8fdb\uff0c\u8fd0\u8425\u76ef\u4f4f\u78c1\u76d8\u6c34\u4f4d\u548c\u7d22\u5f15\u4fdd\u7559\u671f\u3002\u9009\u578b\u65e5\u5fd7\u670d\u52a1\u5668\u65f6\uff0c\u5efa\u8bae\u4f18\u5148\u8003\u8651\u652f\u6301\u6570\u636e\u76d8\u72ec\u7acb\u6269\u5c55\u3001\u7f51\u7edc\u8fde\u901a\u7a33\u5b9a\u7684 VPS \u6216<a href=\"https:\/\/cn.hostease.com\/dedicated-server\/\">\u72ec\u7acb\u670d\u52a1\u5668<\/a>\uff0cHostease \u4e3b\u673a\u4ea7\u54c1\u7ebf\u652f\u6301\u6309\u9700\u6269\u5c55\uff0c\u53ef\u4ece\u4f4e\u914d\u8d77\u6b65\u3001\u968f\u65e5\u5fd7\u91cf\u589e\u957f\u518d\u5347\u7ea7\u3002\u4e0b\u4e00\u6b65\uff1a\u4eca\u5929\u5c31\u6311\u4e00\u53f0\u6d4b\u8bd5\u670d\u52a1\u5668\u628a Filebeat \u8dd1\u901a\uff0c\u7528 <code>logger<\/code> \u547d\u4ee4\u9a8c\u8bc1\u7b2c\u4e00\u6761\u65e5\u5fd7\u6d41\u5165\uff0c\u8ba9\u5e73\u53f0\u771f\u6b63\u53ef\u7528\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5982\u4f55\u7528 Graylog \u89e3\u51b3\u591a\u670d\u52a1\u5668\u65e5\u5fd7\u5206\u6563\u96be\u67e5\u7684\u95ee\u9898\uff1f\u672c\u6587\u8bb2\u89e3 Graylog OpenSearch \u90e8\u7f72\u6b65\u9aa4\u3001\u65e5\u5fd7\u6536\u96c6\u914d\u7f6e\u4e0e\u68c0\u7d22\u6392\u969c\u65b9\u6cd5\uff0c\u5e2e\u52a9\u4e2d\u5c0f\u56e2\u961f\u5feb\u901f\u642d\u5efa\u53ef\u641c\u7d22\u7684\u65e5\u5fd7\u5e73\u53f0\u3002<\/p>\n","protected":false},"author":2,"featured_media":33359,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[3822],"tags":[5145,5147,5148,5146,3734],"class_list":["post-33364","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-guides","tag-graylog","tag-5147","tag-5148","tag-5146","tag-3734"],"aioseo_notices":[],"jetpack_featured_media_url":"https:\/\/cn.hostease.com\/blog\/wp-content\/uploads\/2026\/09\/server-graylog-deployment-cover.webp","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/cn.hostease.com\/blog\/wp-json\/wp\/v2\/posts\/33364","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cn.hostease.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cn.hostease.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cn.hostease.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/cn.hostease.com\/blog\/wp-json\/wp\/v2\/comments?post=33364"}],"version-history":[{"count":1,"href":"https:\/\/cn.hostease.com\/blog\/wp-json\/wp\/v2\/posts\/33364\/revisions"}],"predecessor-version":[{"id":33365,"href":"https:\/\/cn.hostease.com\/blog\/wp-json\/wp\/v2\/posts\/33364\/revisions\/33365"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/cn.hostease.com\/blog\/wp-json\/wp\/v2\/media\/33359"}],"wp:attachment":[{"href":"https:\/\/cn.hostease.com\/blog\/wp-json\/wp\/v2\/media?parent=33364"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cn.hostease.com\/blog\/wp-json\/wp\/v2\/categories?post=33364"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cn.hostease.com\/blog\/wp-json\/wp\/v2\/tags?post=33364"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}