{"id":75111,"date":"2026-02-11T13:33:26","date_gmt":"2026-02-11T05:33:26","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/75111.html"},"modified":"2026-02-11T13:33:26","modified_gmt":"2026-02-11T05:33:26","slug":"logstash%e8%af%a6%e8%a7%a3%e9%85%8d%e7%bd%ae%e4%bd%bf%e7%94%a8","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/75111.html","title":{"rendered":"Logstash\u8be6\u89e3\u914d\u7f6e\u4f7f\u7528"},"content":{"rendered":"<h4>1. Logstash \u662f\u4ec0\u4e48&#xff1f;<\/h4>\n<p>Logstash \u662f Elastic Stack (ELK\/Elastic Stack) \u7684\u6838\u5fc3\u6210\u5458\u4e4b\u4e00&#xff0c;\u626e\u6f14\u7740\u6570\u636e\u5904\u7406\u7ba1\u9053\u7684\u89d2\u8272\u3002\u4f60\u53ef\u4ee5\u628a\u5b83\u60f3\u8c61\u6210\u4e00\u4e2a\u529f\u80fd\u5f3a\u5927\u7684\u201c\u6570\u636e\u52a0\u5de5\u5382\u201d\u3002<\/p>\n<p>\u5b83\u7684\u4e3b\u8981\u5de5\u4f5c\u6d41\u7a0b\u662f&#xff1a;<\/p>\n<li>\u6536\u96c6 (Input)&#xff1a;\u4ece\u5404\u79cd\u6765\u6e90&#xff08;\u5982\u65e5\u5fd7\u6587\u4ef6\u3001\u6570\u636e\u5e93\u3001\u6d88\u606f\u961f\u5217\u3001\u7f51\u7edc\u7aef\u53e3\u7b49&#xff09;\u6536\u96c6\u6570\u636e\u3002<\/li>\n<li>\u5904\u7406 (Filter)&#xff1a;\u5bf9\u6536\u96c6\u5230\u7684\u6570\u636e\u8fdb\u884c\u89e3\u6790\u3001\u8f6c\u6362\u3001\u4e30\u5bcc\u548c\u7ed3\u6784\u5316\u3002\u8fd9\u662f Logstash \u6700\u5f3a\u5927\u7684\u90e8\u5206\u3002<\/li>\n<li>\u8f93\u51fa (Output)&#xff1a;\u5c06\u5904\u7406\u597d\u7684\u6570\u636e\u53d1\u9001\u5230\u4e00\u4e2a\u6216\u591a\u4e2a\u76ee\u7684\u5730&#xff08;\u5982 Elasticsearch\u3001\u6570\u636e\u5e93\u3001\u6587\u4ef6\u3001\u6d88\u606f\u961f\u5217\u7b49&#xff09;\u3002<\/li>\n<p>\u8fd9\u4e2a\u00a0Input -&gt; Filter -&gt; Output\u00a0\u7684\u6d41\u7a0b\u88ab\u79f0\u4e3a\u4e00\u4e2a\u7ba1\u9053 (Pipeline)\u3002<\/p>\n<h4>2.\u6838\u5fc3\u6982\u5ff5<\/h4>\n<ul>\n<li>\u4e8b\u4ef6 (Event)&#xff1a;\u5728 Logstash \u4e2d&#xff0c;\u6bcf\u4e00\u6761\u6570\u636e&#xff08;\u6bd4\u5982\u4e00\u884c\u65e5\u5fd7&#xff09;\u90fd\u88ab\u89c6\u4e3a\u4e00\u4e2a\u201c\u4e8b\u4ef6\u201d\u3002\u4e8b\u4ef6\u662f\u4e00\u4e2a JSON \u5bf9\u8c61&#xff0c;\u5305\u542b\u4e86\u539f\u59cb\u6570\u636e\u4ee5\u53ca Logstash \u5904\u7406\u8fc7\u7a0b\u4e2d\u6dfb\u52a0\u7684\u5143\u6570\u636e\u3002<\/li>\n<li>\u63d2\u4ef6 (Plugin)&#xff1a;Logstash \u7684\u529f\u80fd\u90fd\u662f\u901a\u8fc7\u63d2\u4ef6\u5b9e\u73b0\u7684\u3002\u63d2\u4ef6\u5206\u4e3a\u4e09\u79cd\u7c7b\u578b&#xff0c;\u5bf9\u5e94\u7ba1\u9053\u7684\u4e09\u4e2a\u9636\u6bb5&#xff1a;\n<ul>\n<li>\u8f93\u5165\u63d2\u4ef6 (Input Plugins)&#xff1a;\u8d1f\u8d23\u6570\u636e\u6536\u96c6\u3002<\/li>\n<li>\u8fc7\u6ee4\u63d2\u4ef6 (Filter Plugins)&#xff1a;\u8d1f\u8d23\u6570\u636e\u5904\u7406\u3002<\/li>\n<li>\u8f93\u51fa\u63d2\u4ef6 (Output Plugins)&#xff1a;\u8d1f\u8d23\u6570\u636e\u53d1\u9001\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\u914d\u7f6e\u6587\u4ef6 (Configuration File)&#xff1a;\u5b9a\u4e49 Logstash \u7ba1\u9053\u884c\u4e3a\u7684\u6587\u4ef6\u3002\u901a\u5e38\u4ee5\u00a0.conf\u00a0\u7ed3\u5c3e\u3002<\/li>\n<\/ul>\n<h4>3. \u5b89\u88c5\u4e0e\u8fd0\u884c<\/h4>\n<h5>\u524d\u63d0\u6761\u4ef6<\/h5>\n<ul>\n<li>\u5b89\u88c5 Java 8 \u6216 Java 11\u3002\u4f60\u53ef\u4ee5\u901a\u8fc7\u00a0java -version\u00a0\u547d\u4ee4\u68c0\u67e5\u3002<\/li>\n<\/ul>\n<h5>\u5b89\u88c5<\/h5>\n<li>\u4ece\u00a0Elastic \u5b98\u7f51\u4e0b\u8f7d Logstash\u3002<\/li>\n<li>\u89e3\u538b\u4e0b\u8f7d\u7684\u538b\u7f29\u5305\u3002<\/li>\n<h5>\u8fd0\u884c<\/h5>\n<p>Logstash \u7684\u8fd0\u884c\u975e\u5e38\u7b80\u5355&#xff0c;\u6838\u5fc3\u547d\u4ee4\u662f&#xff1a;<\/p>\n<p># -f \u53c2\u6570\u6307\u5b9a\u914d\u7f6e\u6587\u4ef6<br \/>\nbin\/logstash -f &lt;your_config_file.conf&gt;<\/p>\n<p>\u5728\u5f00\u59cb\u7f16\u5199\u590d\u6742\u914d\u7f6e\u524d&#xff0c;\u5148\u6765\u4e00\u4e2a\u6700\u7b80\u5355\u7684\u201cHello World\u201d\u793a\u4f8b\u3002<\/p>\n<p>\u521b\u5efa\u4e00\u4e2a\u540d\u4e3a\u00a0first-pipeline.conf\u00a0\u7684\u6587\u4ef6&#xff1a;<\/p>\n<p># first-pipeline.conf<\/p>\n<p># \u8f93\u5165&#xff1a;\u4ece\u6807\u51c6\u8f93\u5165&#xff08;\u4f60\u7684\u952e\u76d8&#xff09;\u63a5\u6536\u6570\u636e<br \/>\ninput {<br \/>\n  stdin {}<br \/>\n}<\/p>\n<p># \u8f93\u51fa&#xff1a;\u5c06\u6570\u636e\u683c\u5f0f\u5316\u540e\u8f93\u51fa\u5230\u6807\u51c6\u8f93\u51fa&#xff08;\u4f60\u7684\u5c4f\u5e55&#xff09;<br \/>\noutput {<br \/>\n  stdout {<br \/>\n    codec &#061;&gt; rubydebug # rubydebug \u662f\u4e00\u79cd\u683c\u5f0f&#xff0c;\u8ba9\u8f93\u51fa\u66f4\u6613\u8bfb<br \/>\n  }<br \/>\n}<\/p>\n<p>\u8fd0\u884c\u5b83&#xff1a;<\/p>\n<p>bin\/logstash -f first-pipeline.conf<\/p>\n<p>\u542f\u52a8\u540e&#xff0c;\u5728\u63a7\u5236\u53f0\u8f93\u5165 \u201chello logstash\u201d&#xff0c;\u7136\u540e\u6309\u56de\u8f66\u3002\u4f60\u4f1a\u770b\u5230\u7c7b\u4f3c\u4e0b\u9762\u7684\u8f93\u51fa&#xff1a;<\/p>\n<p>{<br \/>\n       &#034;message&#034; &#061;&gt; &#034;hello logstash&#034;,<br \/>\n      &#034;&#064;version&#034; &#061;&gt; &#034;1&#034;,<br \/>\n          &#034;host&#034; &#061;&gt; &#034;your-hostname&#034;,<br \/>\n    &#034;&#064;timestamp&#034; &#061;&gt; 2023-10-27T08:30:00.123Z<br \/>\n}<\/p>\n<p>\u8fd9\u8bc1\u660e\u4f60\u7684 Logstash \u7ba1\u9053\u5df2\u7ecf\u6210\u529f\u8fd0\u884c\u3002message\u00a0\u662f\u4f60\u8f93\u5165\u7684\u5185\u5bb9&#xff0c;&#064;version,\u00a0host,\u00a0&#064;timestamp\u00a0\u662f Logstash \u81ea\u52a8\u4e3a\u6bcf\u4e2a\u4e8b\u4ef6\u6dfb\u52a0\u7684\u5143\u6570\u636e\u3002<\/p>\n<hr \/>\n<h4>4. \u914d\u7f6e\u6587\u4ef6\u8be6\u89e3<\/h4>\n<p>Logstash \u914d\u7f6e\u6587\u4ef6\u7531\u4e09\u4e2a\u4e3b\u8981\u90e8\u5206\u7ec4\u6210&#xff1a;input,\u00a0filter,\u00a0output\u3002<\/p>\n<p># \u8f93\u5165\u6bb5<br \/>\ninput {<br \/>\n  # &#8230; \u4e00\u4e2a\u6216\u591a\u4e2a\u8f93\u5165\u63d2\u4ef6\u914d\u7f6e &#8230;<br \/>\n}<\/p>\n<p># \u8fc7\u6ee4\u6bb5&#xff08;\u53ef\u9009&#xff09;<br \/>\nfilter {<br \/>\n  # &#8230; \u4e00\u4e2a\u6216\u591a\u4e2a\u8fc7\u6ee4\u63d2\u4ef6\u914d\u7f6e &#8230;<br \/>\n}<\/p>\n<p># \u8f93\u51fa\u6bb5<br \/>\noutput {<br \/>\n  # &#8230; \u4e00\u4e2a\u6216\u591a\u4e2a\u8f93\u51fa\u63d2\u4ef6\u914d\u7f6e &#8230;<br \/>\n}<\/p>\n<h5>4.1 \u8f93\u5165\u63d2\u4ef6 (Input)<\/h5>\n<p>\u4f5c\u7528&#xff1a;\u5b9a\u4e49\u6570\u636e\u4ece\u54ea\u91cc\u6765\u3002<\/p>\n<p>\u5e38\u7528\u63d2\u4ef6\u793a\u4f8b&#xff1a;<\/p>\n<ul>\n<li>\n<p>file: \u4ece\u6587\u4ef6\u4e2d\u8bfb\u53d6\u6570\u636e&#xff0c;\u975e\u5e38\u9002\u5408\u8bfb\u53d6\u65e5\u5fd7\u6587\u4ef6\u3002\u5b83\u4f1a\u8bb0\u5f55\u8bfb\u53d6\u4f4d\u7f6e&#xff0c;\u4e0d\u4f1a\u91cd\u590d\u8bfb\u53d6\u3002<\/p>\n<p> input {<br \/>\n  file {<br \/>\n    path &#061;&gt; &#034;\/var\/log\/nginx\/access.log&#034; # \u8981\u8bfb\u53d6\u7684\u6587\u4ef6\u8def\u5f84<br \/>\n    start_position &#061;&gt; &#034;beginning&#034;       # \u4ece\u6587\u4ef6\u5f00\u5934\u5f00\u59cb\u8bfb\u53d6<br \/>\n    sincedb_path &#061;&gt; &#034;\/dev\/null&#034;         # (\u53ef\u9009) \u5728\u5f00\u53d1\u6d4b\u8bd5\u65f6&#xff0c;\u7981\u6b62\u8bb0\u5f55\u8bfb\u53d6\u4f4d\u7f6e&#xff0c;\u65b9\u4fbf\u91cd\u590d\u6d4b\u8bd5<br \/>\n  }<br \/>\n}\n <\/li>\n<li>\n<p>beats: \u63a5\u6536\u6765\u81ea Filebeat\u3001Metricbeat \u7b49 Beats \u5bb6\u65cf\u6210\u5458\u53d1\u9001\u7684\u6570\u636e\u3002\u8fd9\u662f\u751f\u4ea7\u73af\u5883\u4e2d\u975e\u5e38\u63a8\u8350\u7684\u7ec4\u5408\u3002<\/p>\n<p> input {<br \/>\n  beats {<br \/>\n    port &#061;&gt; 5044 # \u76d1\u542c\u7684\u7aef\u53e3<br \/>\n  }<br \/>\n}\n <\/li>\n<li>\n<p>tcp\u00a0\/\u00a0udp: \u76d1\u542c\u4e00\u4e2a TCP \u6216 UDP \u7aef\u53e3\u6765\u63a5\u6536\u6570\u636e\u3002<\/p>\n<p> input {<br \/>\n  tcp {<br \/>\n    port &#061;&gt; 9999<br \/>\n    codec &#061;&gt; &#034;json&#034; # \u5047\u8bbe\u4f20\u5165\u7684\u6570\u636e\u662f JSON \u683c\u5f0f<br \/>\n  }<br \/>\n}\n <\/li>\n<li>\n<p>kafka: \u4ece Kafka \u4e3b\u9898\u4e2d\u6d88\u8d39\u6570\u636e\u3002<\/p>\n<p> input {<br \/>\n  kafka {<br \/>\n    bootstrap_servers &#061;&gt; &#034;kafka-server:9092&#034;<br \/>\n    topics &#061;&gt; [&#034;log-topic&#034;]<br \/>\n  }<br \/>\n}\n <\/li>\n<li>\n<p>jdbc: \u901a\u8fc7 JDBC \u5b9a\u671f\u67e5\u8be2\u6570\u636e\u5e93\u3002<\/p>\n<p> input {<br \/>\n  jdbc {<br \/>\n    jdbc_driver_library &#061;&gt; &#034;\/path\/to\/mysql-connector-java.jar&#034;<br \/>\n    jdbc_driver_class &#061;&gt; &#034;com.mysql.jdbc.Driver&#034;<br \/>\n    jdbc_connection_string &#061;&gt; &#034;jdbc:mysql:\/\/db-server:3306\/mydatabase&#034;<br \/>\n    jdbc_user &#061;&gt; &#034;user&#034;<br \/>\n    jdbc_password &#061;&gt; &#034;password&#034;<br \/>\n    statement &#061;&gt; &#034;SELECT * from logs WHERE timestamp &gt; :sql_last_value&#034;<br \/>\n    schedule &#061;&gt; &#034;*\/5 * * * *&#034; # \u6bcf5\u5206\u949f\u6267\u884c\u4e00\u6b21<br \/>\n  }<br \/>\n}\n <\/li>\n<\/ul>\n<h5>4.2 \u8fc7\u6ee4\u63d2\u4ef6 (Filter)<\/h5>\n<p>\u4f5c\u7528&#xff1a;\u6570\u636e\u5904\u7406\u7684\u6838\u5fc3&#xff0c;\u5bf9\u4e8b\u4ef6\u8fdb\u884c\u89e3\u6790\u3001\u8f6c\u6362\u3001\u4e30\u5bcc\u3002<\/p>\n<p>\u5e38\u7528\u63d2\u4ef6\u793a\u4f8b&#xff1a;<\/p>\n<ul>\n<li>\n<p>grok:\u00a0(\u6700\u91cd\u8981)\u00a0\u7528\u4e8e\u89e3\u6790\u975e\u7ed3\u6784\u5316\u6587\u672c\u6570\u636e&#xff0c;\u5c06\u5176\u8f6c\u6362\u4e3a\u7ed3\u6784\u5316\u6570\u636e\u3002\u5b83\u4f7f\u7528\u9884\u5b9a\u4e49\u7684\u6b63\u5219\u8868\u8fbe\u5f0f\u6a21\u5f0f\u3002<\/p>\n<ul>\n<li>\u573a\u666f&#xff1a;\u89e3\u6790 Nginx \u6216 Apache \u7684\u8bbf\u95ee\u65e5\u5fd7\u3002<\/li>\n<li>\u793a\u4f8b&#xff1a; # \u539f\u59cb\u65e5\u5fd7: 127.0.0.1 &#8211; &#8211; [27\/Oct\/2023:12:00:00 &#043;0800] &#034;GET \/index.html HTTP\/1.1&#034; 200 1234<br \/>\nfilter {<br \/>\n  grok {<br \/>\n    # %{COMBINEDAPACHELOG} \u662f\u4e00\u4e2a\u9884\u5b9a\u4e49\u7684 grok \u6a21\u5f0f<br \/>\n    match &#061;&gt; { &#034;message&#034; &#061;&gt; &#034;%{COMBINEDAPACHELOG}&#034; }<br \/>\n  }<br \/>\n}<br \/>\n \u89e3\u6790\u540e&#xff0c;\u4e8b\u4ef6\u4f1a\u589e\u52a0\u00a0clientip,\u00a0verb,\u00a0request,\u00a0response,\u00a0bytes\u00a0\u7b49\u5b57\u6bb5\u3002 <\/p>\n<p>\u6280\u5de7&#xff1a;\u4f7f\u7528\u00a0Kibana Grok Debugger\u00a0\u5de5\u5177\u53ef\u4ee5\u975e\u5e38\u65b9\u4fbf\u5730\u6d4b\u8bd5\u548c\u521b\u5efa\u4f60\u7684 Grok \u6a21\u5f0f\u3002<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>mutate: \u7528\u4e8e\u5bf9\u5b57\u6bb5\u8fdb\u884c\u901a\u7528\u64cd\u4f5c&#xff0c;\u5982\u91cd\u547d\u540d\u3001\u5220\u9664\u3001\u66ff\u6362\u548c\u7c7b\u578b\u8f6c\u6362\u3002<\/p>\n<p> filter {<br \/>\n  mutate {<br \/>\n    # \u5c06 &#034;response&#034; \u5b57\u6bb5\u7684\u503c\u8f6c\u6362\u4e3a\u6574\u6570<br \/>\n    convert &#061;&gt; { &#034;response&#034; &#061;&gt; &#034;integer&#034; }<br \/>\n    # \u91cd\u547d\u540d &#034;clientip&#034; \u5b57\u6bb5\u4e3a &#034;client_address&#034;<br \/>\n    rename &#061;&gt; { &#034;clientip&#034; &#061;&gt; &#034;client_address&#034; }<br \/>\n    # \u5220\u9664\u4e0d\u9700\u8981\u7684\u5b57\u6bb5<br \/>\n    remove_field &#061;&gt; [&#034;field_to_remove_1&#034;, &#034;field_to_remove_2&#034;]<br \/>\n    # \u6dfb\u52a0\u65b0\u5b57\u6bb5<br \/>\n    add_field &#061;&gt; { &#034;processed_by&#034; &#061;&gt; &#034;logstash-server-1&#034; }<br \/>\n  }<br \/>\n}\n <\/li>\n<li>\n<p>date: \u89e3\u6790\u5b57\u6bb5\u4e2d\u7684\u65f6\u95f4\u5b57\u7b26\u4e32&#xff0c;\u5e76\u7528\u5b83\u6765\u66ff\u6362 Logstash \u4e8b\u4ef6\u7684\u9ed8\u8ba4\u00a0&#064;timestamp\u00a0\u5b57\u6bb5\u3002\u8fd9\u5bf9\u4e8e\u786e\u4fdd\u4e8b\u4ef6\u65f6\u95f4\u51c6\u786e\u6027\u81f3\u5173\u91cd\u8981\u3002<\/p>\n<p> # Nginx \u65e5\u5fd7\u4e2d\u7684\u65f6\u95f4\u683c\u5f0f: [27\/Oct\/2023:12:00:00 &#043;0800]<br \/>\nfilter {<br \/>\n  grok {<br \/>\n    match &#061;&gt; { &#034;message&#034; &#061;&gt; &#034;%{HTTPDATE:log_timestamp}&#034; }<br \/>\n  }<br \/>\n  date {<br \/>\n    # \u5339\u914d log_timestamp \u5b57\u6bb5\u4e2d\u7684\u65f6\u95f4<br \/>\n    match &#061;&gt; [ &#034;log_timestamp&#034;, &#034;dd\/MMM\/yyyy:HH:mm:ss Z&#034; ]<br \/>\n    # \u6210\u529f\u89e3\u6790\u540e&#xff0c;\u5220\u9664\u539f\u59cb\u7684 log_timestamp \u5b57\u6bb5<br \/>\n    remove_field &#061;&gt; [ &#034;log_timestamp&#034; ]<br \/>\n  }<br \/>\n}\n <\/li>\n<li>\n<p>json: \u89e3\u6790\u503c\u4e3a JSON \u5b57\u7b26\u4e32\u7684\u5b57\u6bb5\u3002<\/p>\n<p> # \u5982\u679c\u539f\u59cb message \u662f: { &#034;user&#034;: &#034;john&#034;, &#034;action&#034;: &#034;login&#034; }<br \/>\nfilter {<br \/>\n  json {<br \/>\n    source &#061;&gt; &#034;message&#034; # \u6307\u5b9a\u8981\u89e3\u6790\u7684\u5b57\u6bb5<br \/>\n  }<br \/>\n}<br \/>\n# \u89e3\u6790\u540e&#xff0c;\u4e8b\u4ef6\u4f1a\u589e\u52a0 user \u548c action \u4e24\u4e2a\u5b57\u6bb5\n <\/li>\n<li>\n<p>geoip: \u6839\u636e IP \u5730\u5740\u4fe1\u606f&#xff0c;\u6dfb\u52a0\u5730\u7406\u4f4d\u7f6e\u6570\u636e&#xff08;\u5982\u56fd\u5bb6\u3001\u57ce\u5e02\u3001\u7ecf\u7eac\u5ea6&#xff09;\u3002<\/p>\n<p> filter {<br \/>\n  geoip {<br \/>\n    source &#061;&gt; &#034;client_address&#034; # \u6307\u5b9a\u5305\u542b IP \u5730\u5740\u7684\u5b57\u6bb5<br \/>\n  }<br \/>\n}<br \/>\n# \u6210\u529f\u540e&#xff0c;\u4f1a\u6dfb\u52a0\u4e00\u4e2a geoip \u5b57\u6bb5&#xff0c;\u91cc\u9762\u5305\u542b location, country_name \u7b49\u4fe1\u606f\n <\/li>\n<\/ul>\n<p>\u6761\u4ef6\u5224\u65ad (Conditionals)<\/p>\n<p>filter\u00a0\u5757\u652f\u6301\u00a0if,\u00a0else if,\u00a0else\u00a0\u8bed\u53e5&#xff0c;\u53ef\u4ee5\u6839\u636e\u4e0d\u540c\u7c7b\u578b\u7684\u65e5\u5fd7\u6267\u884c\u4e0d\u540c\u7684\u5904\u7406\u903b\u8f91\u3002<\/p>\n<p>filter {<br \/>\n  if [type] &#061;&#061; &#034;nginx-access&#034; {<br \/>\n    grok { &#8230; }<br \/>\n  } else if [type] &#061;&#061; &#034;app-json&#034; {<br \/>\n    json { &#8230; }<br \/>\n  } else {<br \/>\n    # \u5176\u4ed6\u5904\u7406<br \/>\n  }<br \/>\n}<\/p>\n<h5>4.3 \u8f93\u51fa\u63d2\u4ef6 (Output)<\/h5>\n<p>\u4f5c\u7528&#xff1a;\u5b9a\u4e49\u5904\u7406\u597d\u7684\u6570\u636e\u53d1\u9001\u5230\u54ea\u91cc\u3002<\/p>\n<p>\u5e38\u7528\u63d2\u4ef6\u793a\u4f8b&#xff1a;<\/p>\n<ul>\n<li>\n<p>elasticsearch:\u00a0(\u6700\u5e38\u7528)\u00a0\u5c06\u6570\u636e\u53d1\u9001\u5230 Elasticsearch \u96c6\u7fa4\u3002<\/p>\n<p> output {<br \/>\n  elasticsearch {<br \/>\n    hosts &#061;&gt; [&#034;http:\/\/es-node1:9200&#034;, &#034;http:\/\/es-node2:9200&#034;] # ES \u96c6\u7fa4\u5730\u5740<br \/>\n    index &#061;&gt; &#034;logstash-%{&#043;YYYY.MM.dd}&#034; # \u7d22\u5f15\u540d\u79f0&#xff0c;\u6309\u5929\u521b\u5efa<br \/>\n    user &#061;&gt; &#034;elastic&#034;<br \/>\n    password &#061;&gt; &#034;your_password&#034;<br \/>\n  }<br \/>\n}\n <\/li>\n<li>\n<p>stdout: \u8f93\u51fa\u5230\u6807\u51c6\u8f93\u51fa&#xff0c;\u4e3b\u8981\u7528\u4e8e\u8c03\u8bd5\u3002<\/p>\n<p> output {<br \/>\n  stdout {<br \/>\n    codec &#061;&gt; rubydebug # \u683c\u5f0f\u5316\u8f93\u51fa&#xff0c;\u4fbf\u4e8e\u67e5\u770b<br \/>\n  }<br \/>\n}\n <\/li>\n<li>\n<p>file: \u5c06\u6570\u636e\u5199\u5165\u6587\u4ef6\u3002<\/p>\n<p> output {<br \/>\n  file {<br \/>\n    path &#061;&gt; &#034;\/tmp\/logstash_output.log&#034;<br \/>\n  }<br \/>\n}\n <\/li>\n<li>\n<p>kafka: \u5c06\u6570\u636e\u53d1\u9001\u5230 Kafka\u3002<\/p>\n<p> output {<br \/>\n  kafka {<br \/>\n    bootstrap_servers &#061;&gt; &#034;kafka-server:9092&#034;<br \/>\n    topic_id &#061;&gt; &#034;processed_logs&#034;<br \/>\n  }<br \/>\n}\n <\/li>\n<\/ul>\n<hr \/>\n<h4>5. \u5b9e\u6218\u6848\u4f8b&#xff1a;\u89e3\u6790 Nginx \u8bbf\u95ee\u65e5\u5fd7\u5e76\u5b58\u5165 Elasticsearch<\/h4>\n<p>\u76ee\u6807&#xff1a;<\/p>\n<li>\u8bfb\u53d6 Nginx \u8bbf\u95ee\u65e5\u5fd7\u6587\u4ef6\u00a0\/var\/log\/nginx\/access.log\u3002<\/li>\n<li>\u4f7f\u7528 Grok \u89e3\u6790\u65e5\u5fd7\u5185\u5bb9\u3002<\/li>\n<li>\u6839\u636e\u5ba2\u6237\u7aef IP \u6dfb\u52a0\u5730\u7406\u4f4d\u7f6e\u4fe1\u606f\u3002<\/li>\n<li>\u5c06\u5904\u7406\u540e\u7684\u6570\u636e\u5b58\u5165 Elasticsearch\u3002<\/li>\n<li>\u5728\u5f00\u53d1\u8c03\u8bd5\u65f6&#xff0c;\u540c\u65f6\u5728\u63a7\u5236\u53f0\u6253\u5370\u8f93\u51fa\u3002<\/li>\n<p>\u521b\u5efa\u914d\u7f6e\u6587\u4ef6\u00a0nginx-pipeline.conf:<\/p>\n<p># nginx-pipeline.conf<\/p>\n<p>input {<br \/>\n  file {<br \/>\n    path &#061;&gt; &#034;\/path\/to\/your\/nginx\/access.log&#034;<br \/>\n    start_position &#061;&gt; &#034;beginning&#034;<br \/>\n    # \u5728\u751f\u4ea7\u73af\u5883\u4e2d&#xff0c;\u5e94\u53bb\u6389\u4e0b\u9762\u8fd9\u884c\u6216\u6307\u5b9a\u4e00\u4e2a\u771f\u5b9e\u8def\u5f84<br \/>\n    sincedb_path &#061;&gt; &#034;\/dev\/null&#034;<br \/>\n  }<br \/>\n}<\/p>\n<p>filter {<br \/>\n  # 1. \u4f7f\u7528 grok \u89e3\u6790\u975e\u7ed3\u6784\u5316\u65e5\u5fd7<br \/>\n  grok {<br \/>\n    # COMBINEDAPACHELOG \u662f\u4e00\u4e2a\u5185\u7f6e\u7684\u6a21\u5f0f&#xff0c;\u9002\u7528\u4e8e\u5e38\u89c1\u7684 Nginx\/Apache \u65e5\u5fd7\u683c\u5f0f<br \/>\n    # \u793a\u4f8b\u65e5\u5fd7: 192.168.1.1 &#8211; &#8211; [27\/Oct\/2023:14:10:30 &#043;0800] &#034;GET \/api\/v1\/users HTTP\/1.1&#034; 200 512 &#034;-&#034; &#034;Mozilla\/5.0&#8230;&#034;<br \/>\n    match &#061;&gt; { &#034;message&#034; &#061;&gt; &#034;%{COMBINEDAPACHELOG}&#034; }<br \/>\n  }<\/p>\n<p>  # 2. \u5982\u679c grok \u89e3\u6790\u6210\u529f&#xff0c;\u5219\u7ee7\u7eed\u5904\u7406<br \/>\n  if &#034;_grokparsefailure&#034; not in [tags] {<br \/>\n    # 2.1 \u89e3\u6790\u65f6\u95f4\u6233&#xff0c;\u5e76\u8bbe\u7f6e\u4e3a\u4e8b\u4ef6\u7684\u4e3b\u65f6\u95f4\u6233<br \/>\n    date {<br \/>\n      match &#061;&gt; [ &#034;timestamp&#034;, &#034;dd\/MMM\/yyyy:HH:mm:ss Z&#034; ]<br \/>\n    }<\/p>\n<p>    # 2.2 \u4f7f\u7528 geoip \u63d2\u4ef6&#xff0c;\u901a\u8fc7 clientip \u5b57\u6bb5\u83b7\u53d6\u5730\u7406\u4f4d\u7f6e\u4fe1\u606f<br \/>\n    geoip {<br \/>\n      source &#061;&gt; &#034;clientip&#034;<br \/>\n    }<\/p>\n<p>    # 2.3 \u8f6c\u6362\u5b57\u6bb5\u7c7b\u578b<br \/>\n    mutate {<br \/>\n      convert &#061;&gt; { &#034;bytes&#034; &#061;&gt; &#034;integer&#034; }<br \/>\n      convert &#061;&gt; { &#034;response&#034; &#061;&gt; &#034;integer&#034; }<br \/>\n    }<\/p>\n<p>    # 2.4 (\u53ef\u9009) \u89e3\u6790\u6210\u529f\u540e&#xff0c;\u53ef\u4ee5\u5220\u9664\u539f\u59cb\u7684 message \u5b57\u6bb5\u4ee5\u8282\u7701\u7a7a\u95f4<br \/>\n    mutate {<br \/>\n      remove_field &#061;&gt; [ &#034;message&#034;, &#034;timestamp&#034; ]<br \/>\n    }<br \/>\n  }<br \/>\n}<\/p>\n<p>output {<br \/>\n  # \u8f93\u51fa\u5230 Elasticsearch<br \/>\n  elasticsearch {<br \/>\n    hosts &#061;&gt; [&#034;http:\/\/localhost:9200&#034;]<br \/>\n    index &#061;&gt; &#034;nginx-access-%{&#043;YYYY.MM.dd}&#034;<br \/>\n  }<\/p>\n<p>  # \u540c\u65f6\u8f93\u51fa\u5230\u63a7\u5236\u53f0&#xff0c;\u65b9\u4fbf\u8c03\u8bd5<br \/>\n  stdout {<br \/>\n    codec &#061;&gt; rubydebug<br \/>\n  }<br \/>\n}<\/p>\n<p>\u8fd0\u884c\u4e0e\u6d4b\u8bd5&#xff1a;<\/p>\n<li>\n<p>\u68c0\u67e5\u914d\u7f6e&#xff1a;\u5728\u8fd0\u884c\u524d&#xff0c;\u5148\u68c0\u67e5\u914d\u7f6e\u6587\u4ef6\u8bed\u6cd5\u662f\u5426\u6b63\u786e\u3002<\/p>\n<p> bin\/logstash -f nginx-pipeline.conf &#8211;config.test_and_exit<\/p>\n<p>\u5982\u679c\u770b\u5230\u00a0Configuration OK&#xff0c;\u8bf4\u660e\u914d\u7f6e\u6ca1\u95ee\u9898\u3002<\/p>\n<\/li>\n<li>\n<p>\u8fd0\u884c\u7ba1\u9053&#xff1a;<\/p>\n<p> bin\/logstash -f nginx-pipeline.conf\n <\/li>\n<li>\n<p>\u751f\u6210\u65e5\u5fd7\u00a0(\u53ef\u9009)&#xff1a;\u5411\u4f60\u7684 Nginx \u8bbf\u95ee\u65e5\u5fd7\u6587\u4ef6\u4e2d\u8ffd\u52a0\u4e00\u884c\u65b0\u65e5\u5fd7&#xff0c;\u89c2\u5bdf Logstash \u63a7\u5236\u53f0\u7684\u8f93\u51fa\u3002 \u5904\u7406\u540e\u7684\u8f93\u51fa\u5e94\u8be5\u7c7b\u4f3c\u8fd9\u6837 (rubydebug \u683c\u5f0f)&#xff1a;<\/p>\n<p> {<br \/>\n        &#034;agent&#034; &#061;&gt; &#034;\\\\&#034;Mozilla\/5.0&#8230;\\\\&#034;&#034;,<br \/>\n     &#034;clientip&#034; &#061;&gt; &#034;192.168.1.1&#034;,<br \/>\n         &#034;verb&#034; &#061;&gt; &#034;GET&#034;,<br \/>\n      &#034;request&#034; &#061;&gt; &#034;\/api\/v1\/users&#034;,<br \/>\n  &#034;httpversion&#034; &#061;&gt; &#034;1.1&#034;,<br \/>\n     &#034;response&#034; &#061;&gt; 200,<br \/>\n        &#034;bytes&#034; &#061;&gt; 512,<br \/>\n        &#034;geoip&#034; &#061;&gt; {<br \/>\n                &#034;ip&#034; &#061;&gt; &#034;192.168.1.1&#034;,<br \/>\n      &#034;country_name&#034; &#061;&gt; &#034;China&#034;,<br \/>\n          &#034;city_name&#034; &#061;&gt; &#034;Beijing&#034;,<br \/>\n           &#034;location&#034; &#061;&gt; { &#034;lon&#034; &#061;&gt; 116.3883, &#034;lat&#034; &#061;&gt; 39.9289 }<br \/>\n    },<br \/>\n   &#034;&#064;timestamp&#034; &#061;&gt; 2023-10-27T06:10:30.000Z, \/\/ \u6ce8\u610f\u65f6\u95f4\u5df2\u7ecf\u8f6c\u4e3a UTC<br \/>\n     &#8230;<br \/>\n}<\/p>\n<p>\u540c\u65f6&#xff0c;\u8fd9\u4e9b\u7ed3\u6784\u5316\u6570\u636e\u4e5f\u4f1a\u88ab\u53d1\u9001\u5230 Elasticsearch \u4e2d\u540d\u4e3a\u00a0nginx-access-YYYY.MM.DD\u00a0\u7684\u7d22\u5f15\u91cc\u3002<\/p>\n<\/li>\n<hr \/>\n<h4>6. \u9ad8\u7ea7\u4e3b\u9898\u4e0e\u6700\u4f73\u5b9e\u8df5<\/h4>\n<ul>\n<li>\u591a\u7ba1\u9053 (Multiple Pipelines)&#xff1a;\u4e0d\u8981\u628a\u6240\u6709\u903b\u8f91\u90fd\u653e\u5728\u4e00\u4e2a\u5de8\u5927\u7684\u914d\u7f6e\u6587\u4ef6\u91cc\u3002\u4f7f\u7528\u00a0pipelines.yml\u00a0\u6587\u4ef6\u6765\u5b9a\u4e49\u548c\u7ba1\u7406\u591a\u4e2a\u72ec\u7acb\u7684\u7ba1\u9053&#xff0c;\u63d0\u9ad8\u6a21\u5757\u5316\u548c\u53ef\u7ef4\u62a4\u6027\u3002<\/li>\n<li>\u6301\u4e45\u5316\u961f\u5217 (Persistent Queues)&#xff1a;\u5f53\u8f93\u51fa\u7aef&#xff08;\u5982 Elasticsearch&#xff09;\u4e0d\u53ef\u7528\u65f6&#xff0c;Logstash \u9ed8\u8ba4\u5c06\u4e8b\u4ef6\u7f13\u5b58\u5728\u5185\u5b58\u4e2d\u3002\u5f00\u542f\u6301\u4e45\u5316\u961f\u5217 (queue.type: persisted) \u53ef\u4ee5\u5c06\u961f\u5217\u5199\u5165\u78c1\u76d8&#xff0c;\u9632\u6b62 Logstash \u91cd\u542f\u6216\u5d29\u6e83\u65f6\u6570\u636e\u4e22\u5931\u3002<\/li>\n<li>\u6b7b\u4fe1\u961f\u5217 (Dead Letter Queues &#8211; DLQ)&#xff1a;\u5f53\u4e8b\u4ef6\u65e0\u6cd5\u88ab\u5904\u7406&#xff08;\u5982 JSON \u89e3\u6790\u5931\u8d25&#xff09;\u6216\u65e0\u6cd5\u53d1\u9001\u5230\u8f93\u51fa\u7aef\u65f6&#xff0c;\u53ef\u4ee5\u5c06\u5176\u53d1\u9001\u5230\u6b7b\u4fe1\u961f\u5217&#xff0c;\u4ee5\u4fbf\u540e\u7eed\u5206\u6790\u548c\u5904\u7406&#xff0c;\u800c\u4e0d\u662f\u76f4\u63a5\u4e22\u5f03\u3002<\/li>\n<li>\u6027\u80fd\u8c03\u4f18&#xff1a;\n<ul>\n<li>pipeline.workers&#xff1a;\u589e\u52a0 worker \u6570\u91cf\u53ef\u4ee5\u5e76\u884c\u5904\u7406\u4e8b\u4ef6&#xff0c;\u63d0\u9ad8\u541e\u5410\u91cf&#xff08;\u53d7 CPU \u6838\u5fc3\u6570\u9650\u5236&#xff09;\u3002<\/li>\n<li>pipeline.batch.size&#xff1a;\u8c03\u6574\u6bcf\u4e2a\u6279\u6b21\u5904\u7406\u7684\u4e8b\u4ef6\u6570\u91cf\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\u76d1\u63a7&#xff1a;\u901a\u8fc7 Logstash \u7684\u76d1\u63a7 API (curl -XGET &#039;localhost:9600\/_node\/stats&#039;) \u6765\u83b7\u53d6\u5176\u8fd0\u884c\u72b6\u6001\u3001\u6027\u80fd\u6307\u6807\u548c\u63d2\u4ef6\u4fe1\u606f\u3002<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>1. Logstash \u662f\u4ec0\u4e48&#xff1f;<br \/>\nLogstash \u662f Elastic Stack (ELK\/Elastic Stack) \u7684\u6838\u5fc3\u6210\u5458\u4e4b\u4e00&#xff0c;\u626e\u6f14\u7740\u6570\u636e\u5904\u7406\u7ba1\u9053\u7684\u89d2\u8272\u3002\u4f60\u53ef\u4ee5\u628a\u5b83\u60f3\u8c61\u6210\u4e00\u4e2a\u529f\u80fd\u5f3a\u5927\u7684\u201c\u6570\u636e\u52a0\u5de5\u5382\u201d\u3002<br \/>\n\u5b83\u7684\u4e3b\u8981\u5de5\u4f5c\u6d41\u7a0b\u662f&#xff1a;<br \/>\n\u6536\u96c6 (Input)&#xff1a;\u4ece\u5404\u79cd\u6765\u6e90&#xff08;\u5982\u65e5\u5fd7\u6587\u4ef6\u3001\u6570\u636e\u5e93\u3001\u6d88\u606f\u961f\u5217\u3001\u7f51\u7edc\u7aef\u53e3\u7b49&#xff09;\u6536\u96c6\u6570\u636e\u3002\u5904\u7406 (Filter)&#xff1a;\u5bf9\u6536\u96c6\u5230\u7684\u6570\u636e\u8fdb\u884c\u89e3\u6790\u3001\u8f6c\u6362\u3001<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[99],"topic":[],"class_list":["post-75111","post","type-post","status-publish","format-standard","hentry","category-server","tag-java"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Logstash\u8be6\u89e3\u914d\u7f6e\u4f7f\u7528 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/75111.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Logstash\u8be6\u89e3\u914d\u7f6e\u4f7f\u7528 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"1. Logstash \u662f\u4ec0\u4e48&#xff1f; Logstash \u662f Elastic Stack (ELK\/Elastic Stack) \u7684\u6838\u5fc3\u6210\u5458\u4e4b\u4e00&#xff0c;\u626e\u6f14\u7740\u6570\u636e\u5904\u7406\u7ba1\u9053\u7684\u89d2\u8272\u3002\u4f60\u53ef\u4ee5\u628a\u5b83\u60f3\u8c61\u6210\u4e00\u4e2a\u529f\u80fd\u5f3a\u5927\u7684\u201c\u6570\u636e\u52a0\u5de5\u5382\u201d\u3002 \u5b83\u7684\u4e3b\u8981\u5de5\u4f5c\u6d41\u7a0b\u662f&#xff1a; \u6536\u96c6 (Input)&#xff1a;\u4ece\u5404\u79cd\u6765\u6e90&#xff08;\u5982\u65e5\u5fd7\u6587\u4ef6\u3001\u6570\u636e\u5e93\u3001\u6d88\u606f\u961f\u5217\u3001\u7f51\u7edc\u7aef\u53e3\u7b49&#xff09;\u6536\u96c6\u6570\u636e\u3002\u5904\u7406 (Filter)&#xff1a;\u5bf9\u6536\u96c6\u5230\u7684\u6570\u636e\u8fdb\u884c\u89e3\u6790\u3001\u8f6c\u6362\u3001\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/75111.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-02-11T05:33:26+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/75111.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/75111.html\",\"name\":\"Logstash\u8be6\u89e3\u914d\u7f6e\u4f7f\u7528 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-02-11T05:33:26+00:00\",\"dateModified\":\"2026-02-11T05:33:26+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/75111.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/75111.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/75111.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Logstash\u8be6\u89e3\u914d\u7f6e\u4f7f\u7528\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Logstash\u8be6\u89e3\u914d\u7f6e\u4f7f\u7528 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/75111.html","og_locale":"zh_CN","og_type":"article","og_title":"Logstash\u8be6\u89e3\u914d\u7f6e\u4f7f\u7528 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"1. Logstash \u662f\u4ec0\u4e48&#xff1f; Logstash \u662f Elastic Stack (ELK\/Elastic Stack) \u7684\u6838\u5fc3\u6210\u5458\u4e4b\u4e00&#xff0c;\u626e\u6f14\u7740\u6570\u636e\u5904\u7406\u7ba1\u9053\u7684\u89d2\u8272\u3002\u4f60\u53ef\u4ee5\u628a\u5b83\u60f3\u8c61\u6210\u4e00\u4e2a\u529f\u80fd\u5f3a\u5927\u7684\u201c\u6570\u636e\u52a0\u5de5\u5382\u201d\u3002 \u5b83\u7684\u4e3b\u8981\u5de5\u4f5c\u6d41\u7a0b\u662f&#xff1a; \u6536\u96c6 (Input)&#xff1a;\u4ece\u5404\u79cd\u6765\u6e90&#xff08;\u5982\u65e5\u5fd7\u6587\u4ef6\u3001\u6570\u636e\u5e93\u3001\u6d88\u606f\u961f\u5217\u3001\u7f51\u7edc\u7aef\u53e3\u7b49&#xff09;\u6536\u96c6\u6570\u636e\u3002\u5904\u7406 (Filter)&#xff1a;\u5bf9\u6536\u96c6\u5230\u7684\u6570\u636e\u8fdb\u884c\u89e3\u6790\u3001\u8f6c\u6362\u3001","og_url":"https:\/\/www.wsisp.com\/helps\/75111.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-02-11T05:33:26+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"4 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/75111.html","url":"https:\/\/www.wsisp.com\/helps\/75111.html","name":"Logstash\u8be6\u89e3\u914d\u7f6e\u4f7f\u7528 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-02-11T05:33:26+00:00","dateModified":"2026-02-11T05:33:26+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/75111.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/75111.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/75111.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"Logstash\u8be6\u89e3\u914d\u7f6e\u4f7f\u7528"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/75111","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=75111"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/75111\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=75111"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=75111"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=75111"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=75111"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}