Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个以时间戳等开头的drupal看门狗日志文件,syslog然后有一个管道分隔的我登录看门狗的东西。现在我正在编写一个 grok 过滤规则来从中获取字段。
syslog
我在消息正文中有一些 URL,因此我使用%{URI:request}例如获取这些 URL。但是,这会创建一个名为port始终为空的字段,并且我不想将很多空字段放入我的弹性搜索数据库中,所以我想知道如何摆脱看起来像这样的空数组:"port": [null, null, null]。
%{URI:request}
port
"port": [null, null, null]
如果您想无条件地删除一个字段,只需添加一个remove_field => ['port']到您的grok块。
remove_field => ['port']
grok
如果您想有条件地删除某些内容,您可以使用ruby过滤器在删除之前检查字段中的内容,或者使用过滤器if周围的内容。mutate { remove_field => ['port'] }
ruby
if
mutate { remove_field => ['port'] }