Filebeat可以使用多个配置文件吗? [英] Can Filebeat use multiple config files?

查看:1970
本文介绍了Filebeat可以使用多个配置文件吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有多个应用程序在单个服务器上运行。我想使用filebeat将每个日志发送到logstash。但是,为了进行配置管理,我希望能够分别为每个应用程序将配置添加到filebeat中。

I have several applications running on a single server. I'd like to use filebeat to ship the logs of each of them to logstash. However, for the sake of configuration management, I'd like to be able to add configuration to filebeat for each app separately.

Logstash从<$ c中读取其配置$ c> conf.d 目录。据我了解,人们可以在其中添加文件,并且在logstash加载文件时将它们合并在一起。文件拍是否有类似功能?还是我坚持每个服务器维护一个 filebeat.yml 文件?

Logstash reads its config from a conf.d directory. It's my understanding that one can add files there and they get combined when logstash loads them. Is there any similar feature for filebeat? Or am I stuck with maintaining a single filebeat.yml file per server?

我同时运行filebeat和在弹性存储库。 Filebeat是1.3.1版,logstash是2.4.0版。

I'm running both filebeat and logstash as services on CentOS 7, using the yum/rpm packages from elastic's repositories. Filebeat is version 1.3.1 and logstash is version 2.4.0.

推荐答案

是的,Filebeat的 conf.d 之类的功能,但默认情况下未启用。 Filebeat将在声明的目录中查找包含探矿者配置的其他 *。yml 文件。配置因Filebeat主版本而异。

Yes, Filebeat has a conf.d like feature, but it is not enabled by default. Filebeat will look inside of the declared directory for additional *.yml files that contain prospector configurations. The configuration varies by Filebeat major version.

其行为与6.x相同,但配置选项为 filebeat.config.inputs 而不是 filebeat.config.prospectors

The behavior is the same as 6.x, but the config option is filebeat.config.inputs instead of filebeat.config.prospectors.

# /etc/filebeat/filebeat.yml
filebeat.config.inputs:
  enabled: true
  path: inputs.d/*.yml

然后为每个生成日志的应用创建单独的配置文件。

Then create individual config files for each app that's generating logs.

# /etc/filebeat/inputs.d/someapp.yml
- paths:
  - /var/log/someapp/stdout.log
  fields:
    app: someapp



Filebeat 6.x:



您在路径选项/en/beats/filebeat/6.x/filebeat-configuration-reloading.html#filebeat-configuration-reloading rel = nofol low noreferrer> filebeat.yml文件的 filebeat.config.prospectors 部分。

Filebeat 6.x:

You specify a path option in the filebeat.config.prospectors section of the filebeat.yml file.

filebeat.config.prospectors:
  enabled: true
  path: /etc/filebeat/conf.d/*.yml

/etc/filebeat/conf.d/someapp.yml

/etc/filebeat/conf.d/someapp.yml

此文件包含 filebeat.prospectors ,就像在早期版本中一样。

Note that this file does not contain filebeat.prospectors like it did in earlier versions.

- paths:
    - /var/log/someapp/stdout.log
  fields:
    app: someapp



文件拍1.x和5.x:



您声明使用 config_dir 选项。

filebeat:
  config_dir: /etc/filebeat/conf.d

/etc/filebeat/conf.d/ someapp.yml

/etc/filebeat/conf.d/someapp.yml

filebeat:
  prospectors:
    - paths:
        - /var/log/someapp/stdout.log
      fields:
        app: someapp

这篇关于Filebeat可以使用多个配置文件吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆