{"id":1669,"date":"2023-03-25T22:22:10","date_gmt":"2023-03-25T14:22:10","guid":{"rendered":"https:\/\/www.appblog.cn\/?p=1669"},"modified":"2023-04-23T21:52:33","modified_gmt":"2023-04-23T13:52:33","slug":"logstash-excludes-fields-and-their-contents","status":"publish","type":"post","link":"https:\/\/www.appblog.cn\/index.php\/2023\/03\/25\/logstash-excludes-fields-and-their-contents\/","title":{"rendered":"Logstash\u6392\u9664\u5b57\u6bb5\u53ca\u5b57\u6bb5\u5185\u5bb9"},"content":{"rendered":"<h2>\u6392\u9664\u5b57\u6bb5<\/h2>\n<pre><code>filter {\n    grok {\n        remove_field =&gt; [&quot;agent&quot;, &quot;cloud&quot;, &quot;ecs&quot;, &quot;host&quot;, &quot;input&quot;]\n    }\n}<\/code><\/pre>\n<p><!-- more --><\/p>\n<h2>\u6392\u9664\u5b57\u6bb5\u5185\u5bb9<\/h2>\n<pre><code>output {\n    if &quot;_grokparsefailure&quot; in [tags] {\n        file { path =&gt; &quot;\/usr\/local\/logstash\/logs\/grok_failures.txt&quot; }\n    } else {\n        if (([classpath] == &quot;com.netflix.eureka.registry.AbstractInstanceRegistry&quot; and [methodname] == &quot;run&quot;) or\n            ([classpath] == &quot;com.netflix.discovery.shared.resolver.aws.ConfigClusterResolver&quot; and [methodname] == &quot;getClusterEndpoints&quot;)) {\n            #stdout {\n               #codec =&gt; rubydebug\n            #}\n        } else {\n            elasticsearch {\n                hosts =&gt; [&quot;172.10.1.10:9200&quot;]\n                #index =&gt; &quot;%{type}&quot;\n                index =&gt; &quot;appblog-%{+YYYY.MM.dd}&quot;\n            }\n        }\n    }\n}<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u6392\u9664\u5b57\u6bb5 filter { grok { remove_field =&gt; [&quot;agent&#038;qu [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[345],"tags":[343],"class_list":["post-1669","post","type-post","status-publish","format-standard","hentry","category-elk","tag-logstash"],"_links":{"self":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/1669","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/comments?post=1669"}],"version-history":[{"count":0,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/1669\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/media?parent=1669"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/categories?post=1669"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/tags?post=1669"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}