在我的Logstash发货人中,我想过滤掉用散列字符注释的行:
- #This log row should be dropped.
- But one this should not.
我能够使用grep过滤器,但由于不鼓励(将要退役),我正在尝试使用grok过滤器来代替它.此过滤器无效:
- grok {
- match => ["message","^#.*"]
- drop_if_match => true
- }
如果您有兴趣,甚至更简单:
- filter {
- if ([message] =~ /^#/) {
- drop{}
- }
- }
Logstash的最后几个版本已经更加强调分支逻辑directly in the config files.需要一点点习惯,但是一旦你这样做就很方便.