{"id":1671,"date":"2023-03-25T22:24:09","date_gmt":"2023-03-25T14:24:09","guid":{"rendered":"https:\/\/www.appblog.cn\/?p=1671"},"modified":"2023-04-23T21:52:11","modified_gmt":"2023-04-23T13:52:11","slug":"remove-field-delete-subfield-after-logstash-filter-target-operation","status":"publish","type":"post","link":"https:\/\/www.appblog.cn\/index.php\/2023\/03\/25\/remove-field-delete-subfield-after-logstash-filter-target-operation\/","title":{"rendered":"Logstash filter target\u64cd\u4f5c\u4e4b\u540eremove_field\u5220\u9664\u5b50\u5b57\u6bb5"},"content":{"rendered":"<pre><code class=\"language-json\">useragent {\n    source =&gt; &quot;agent&quot;\n    target =&gt; &quot;ua&quot;\n    remove_field =&gt; [ &quot;agent&quot;, &quot;[ua][patch]&quot;, &quot;[ua][build]&quot; ]\n}<\/code><\/pre>\n<p><!-- more --><\/p>\n<pre><code class=\"language-json\">grok {\n    patterns_dir =&gt; &quot;\/usr\/local\/logstash\/config_file\/patterns&quot;\n    match =&gt; { &quot;message&quot; =&gt; &quot;%{TIME_STAMP_A:logtime}\\s+\\[\\s*%{APP_NAME:appname}\\s*\\]\\[\\s*%{LOG_LVL:loglvl}\\s*\\]\\s+\\[\\s*%{PROCESS_ID:pid}\\s*\\]\\s+\\[\\s*%{PROCESS_NAME:pname}\\s*\\]\\s+\\[\\s*%{TRACE_ID:traceid}\\s*\\]\\s+\\[\\s*%{SPAN_ID:spanid}\\s*\\]\\s+\\[\\s*%{SPAN_EXPORTABLE}\\s*\\]\\s+---\\s+\\[\\s*%{CLASS_PATH:classpath}\\s*\\]\\s+\\[\\s*%{METHOD_NAME:methodname}\\s*\\]\\s+\\[\\s*%{CODE_LINE:codeline}\\s*\\]\\s+:\\s+%{CONTENT}&quot; }\n    remove_field =&gt; [&quot;agent&quot;, &quot;cloud&quot;, &quot;ecs&quot;, &quot;input&quot;, &quot;[host][architecture]&quot;, &quot;[host][containerized]&quot;, &quot;[host][id]&quot;, &quot;[host][os]&quot;, &quot;[host][hostname]&quot;]\n}<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>useragent { source =&gt; &quot;agent&quot; target =&gt; [&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-1671","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\/1671","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=1671"}],"version-history":[{"count":0,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/1671\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/media?parent=1671"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/categories?post=1671"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/tags?post=1671"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}