带输出的FileBeat配置测试

时间:2018-08-04 05:09:55

标签: filebeat

我正在尝试使用filebeat test ouput -e -c filebeat.yml测试我的配置,我只看到带有命令列表的帮助消息。

我实际上正在尝试输出数据文件进行验证。尽管我已经用ok测试过filebeat test config -e -c filebeat.yml

2 个答案:

答案 0 :(得分:1)

假设您正在使用filebeat 6.x(这些测试是在CentOS 7.5系统中使用filebeat 6.5.0进行的)

要测试文件拍配置(语法),您可以执行以下操作:

[root@localhost ~]# filebeat test config
Config OK

如果您刚刚下载了tarball,则默认情况下它会使用untared filebeat目录中的filebeat.yml。如果安装了RPM,则它将使用/etc/filebeat/filebeat.yml。

如果要定义其他配置文件,可以执行以下操作:

[root@localhost ~]# filebeat test config -c /etc/filebeat/filebeat2.yml
Config OK

要测试输出块(即,如果您可以连接Elasticsearch实例或kafka代理),则可以执行以下操作:

[root@localhost ~]# filebeat test output
elasticsearch: http://localhost:9200...
  parse url... OK
  connection...
    parse host... OK
    dns lookup... OK
    addresses: ::1, 127.0.0.1
    dial up... ERROR dial tcp [::1]:9200: connect: connection refused

在这种情况下,我的localhost弹性搜索已关闭,因此filebeat抛出错误,表明它无法连接到我的输出块。

与语法验证(测试配置)相同,可以为输出连接测试提供不同的配置文件:

[root@localhost ~]# filebeat test output -c /etc/filebeat/filebeat2.yml
logstash: localhost:5044...
  connection...
    parse host... OK
    dns lookup... OK
    addresses: ::1, 127.0.0.1
    dial up... ERROR dial tcp [::1]:5044: connect: connection refused

在此备用配置文件中,我的输出块也无法连接到logstash实例。

答案 1 :(得分:0)

-e -c标志必须在命令“ test”之前使用

filebeat -e -c filebeat.yml test ouput

 -c, --c argList Configuration file, relative to path.config (default beat.yml)