0

我正在尝试将 Zabbix 日志数据输入到 ELK 堆栈中以进行一些时间相关性。但是,我没有得到我的 Logstash 集中式服务器配置指定的过滤器,如果它充当代理时我会这样做。我正在使用 Filebeat 将日志条目发送到 Logstash 进行处理。但是,该fields.tags行没有被 Logstash 确认,但在 Elasticsearch/Kibana 中可见。这是我的配置。

filebeat: 
  prospectors: 
    - 
      paths:
        - /var/log/zabbix/zabbix_proxy.log
      input_type: log
      fields: 
        tags: ["zabbix", "zabbix-proxy"]
  registery_file: /var/lib/filebeat/registry
output: 
  logstash: 
    hosts: ["elkls.com:5044"]
logging: 
  files: 
    rotateeverybytes: 12345656

然后是我的 Logstash 配置文件

input { 
  beats { 
    port => 5044
  }
}
filter { 
  if "zabbix" in [fields.tags] {
    grok { 
      match => { 
        "message" => {
          "filter stuff here"
        }
      }
    }
  }
}
output {
  elasticsearch { 
    hosts => [ "elkhost.com:9200"]
  }
}

Logstash 没有对该fields.tags行起作用,并且过滤/切割从 Filebeat 传递给它的日志行。我是否正确访问了这些变量?我对其他文件做了类似的事情,但只有当 Logstash 充当代理并直接从文件中读取时。

4

1 回答 1

2

代替

if "zabbix" in [fields.tags] {

利用

if "zabbix" in [fields][tags] {

要引用 Logstash 中的嵌套字段,请指定该字段的完整路径:[top-level field][nested field].

资料来源:https ://www.elastic.co/guide/en/logstash/current/event-dependent-configuration.html#logstash-config-field-references

于 2016-09-16T00:14:01.553 回答