Filebeat 配置文件
来自Linux78|wiki
- Filebeat Configuration Example #########################
- This file is an example configuration file highlighting only the most common
- options. The filebeat.reference.yml file from the same directory contains all the
- supported options with more comments. You can use it as a reference.
- You can find the full configuration reference here:
- https://www.elastic.co/guide/en/beats/filebeat/index.html
- For more available modules and options, please see the filebeat.reference.yml sample
- configuration file.
- =========================== Filebeat prospectors =============================
filebeat.prospectors:
- Each - is a prospector. Most options can be set at the prospector level, so
- you can use different prospectors for various configurations.
- Below are the prospector specific configurations.
- type: log
# 更改为 true 以启用此配置。 enabled: false # Paths that should be crawled and fetched. Glob based paths. #应该爬网和提取的路径 paths: - /var/log/*.log #- c:\programdata\elasticsearch\logs\* # 排除行, 要匹配的正则表达式的列表. 它将从列表中删除与任何正则表达式匹配的行. #exclude_lines: ['^DBG'] # 包含行. 要匹配的正则表达式的列表. 它从列表中导出与任何正则表达式匹配的行. #include_lines: ['^ERR', '^WARN'] # 排除文件. 要匹配的正则表达式的列表。 Filebeat 将从列表中删除与任何正则表达式匹配的文件。默认情况下, 不会删除任何文件。 #exclude_files: ['.gz$'] # 可选的附加字段。可以随意选取这些字段, 以便将附加信息添加到已爬网日志文件中以进行筛选 #fields: # level: debug # review: 1 ### 多行选项 # Mutiline 可用于跨越多行的日志消息。这对于 Java 堆栈跟踪或 C 行继续很常见 # 必须匹配的 regexp 模式。示例模式匹配所有开始 [ #multiline.pattern: ^\[ # 定义在模式下设置的模式是否应该被否定。默认值为 false. #multiline.negate: false # 匹配可以设置为 "后" 或 "之前"。它用于定义是否应将行追加到模式 (不匹配) 之前或之后, 或者只要模式不匹配 (基于否定. # Note:后是等同于前和前是等价于下 Logstash #multiline.match: after
- =============================Filebeat 模块 ===============================
filebeat.config.modules:
# 配置加载的环球模式(一个目录)
path: ${path.config}/modules.d/*.yml
# 设置为true来启用配置重载
reload.enabled: false
# 检查路径下的文件更改的期间(多久检查一次)
#reload.period: 10s
- ==================== Elasticsearch 模板设置 ==========================
setup.template.settings:
index.number_of_shards: 3 #index.codec: best_compression #_source.enabled: false
- ================================ 一般设置 =====================================
- The name of the shipper that publishes the network data. It can be used to group
- all the transactions sent by a single shipper in the web interface.
- name:
- The tags of the shipper are included in their own field with each transaction published.
- tags: ["service-X", "web-tier"]
- Optional fields that you can specify to add additional information to the
- output.
- fields:
- env: staging
- ============================== 仪表=====================================
- 这些设置控制将示例仪表板加载到 Kibana 索引。默认情况下, 加载仪表板被禁用, 可以通过在此处设置选项, 或者使用 "安装" CLI 标志或 "安装" 命令来启用。
- setup.dashboards.enabled: false
- 从何处下载仪表板存档的 URL。默认情况下, 此 URL 具有一个基于节拍名称和版本计算的值。对于发布的版本, 此 URL 指向 artifacts.elastic.co 网站上的仪表板存档。
- setup.dashboards.url:
- ============================== Kibana =====================================
- 从版本6.0.0 开始, 仪表板通过 Kibana API 加载。
- 这需要 Kibana 端点配置.
setup.kibana:
# Kibana Host # 方案和端口可以被排除, 并将被设置为默认 (http and 5601) # 如果您指定和附加路径, 则该方案是必需的: http://localhost:5601/path # IPv6 地址应始终定义为: https://[2001:db8::1]:5601 #host: "localhost:5601"
- ============================= Elastic Cloud ==================================
- 这些设置简化了使用 filebeat 与弹性云 (https://cloud.elastic.co/).
- cloud. id 设置将覆盖 "output.elasticsearch.hosts" 和 "设置. kibana. 主机" 选项。
- 您可以在弹性云 web 用户界面中找到 "云 id"。
- cloud.id:
- cloud. 授权设置覆盖 "output.elasticsearch.username" 和 "输出. elasticsearch 密码" 设置。格式为 "<user>: <pass>".
- cloud.auth:
- ================================ Outputs =====================================
- Configure what output to use when sending the data collected by the beat.
- -------------------------- Elasticsearch output ------------------------------
output.elasticsearch:
# 要连接到的主机的数组。 hosts: ["localhost:9200"] # 可选协议和基本身份验证凭据。 #protocol: "https" #username: "elastic" #password: "changeme"
- ----------------------------- Logstash output --------------------------------
- output.logstash:
# The Logstash hosts #hosts: ["localhost:5044"] # 可选的 SSL。默认为 off。 # 用于 HTTPS 服务器验证的根证书列表 #ssl.certificate_authorities: ["/etc/pki/root/ca.pem"] # SSL 客户端身份验证证书 #ssl.certificate: "/etc/pki/client/cert.pem" # 客户端证书密钥 #ssl.key: "/etc/pki/client/cert.key"
- ================================ Logging =====================================
- 设置日志级别。默认日志级别为 "信息"。
- 用的日志级别有: critical, error, warning, info, debug
- 用的日志级别有: 关键、错误、警告、信息、调试
- logging.level: debug
- 在调试级别, 您可以有选择地仅对某些组件启用日志记录。
- 要启用所有选择器, 请使用 ["*"]。其他选择器的例子是 "beat",
- "publish", "service".
- logging.selectors: ["*"]