logstash同时支持多个管道(修改配置文件)

本文档介绍了Logstash如何配置和管理多个任务。通过`pipelines.yml`文件可以定义多个管道,每个管道有自己的ID和配置文件路径。例如,配置文件中展示了两个管道,分别设置了线程数量和队列类型。当使用`-f`参数启动Logstash时,会忽略`pipelines.yml`,而直接启动时会读取该配置文件。理解这一机制对于有效管理和调度Logstash的任务执行至关重要。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

关于logstash多任务参考管方文档https://www.elastic.co/guide/en/logstash/current/multiple-pipelines.html

在使用logstash执行任务时,我们一般会使用
./bin/logstash","-f","./pipeline/logstash-to-es.conf","–config.reload.automatic
命令,这个命令会指定我们的配置启动,但是它会忽略系统的pipelines.yml配置文件

我们可以打开pipelines.yml 看一下

# This file is where you define your pipelines. You can define multiple.
# # For more information on multiple pipelines, see the documentation:
# #   https://www.elastic.co/guide/en/logstash/current/multiple-pipelines.html
#
- pipeline.id: main
  path.config: "/usr/share/logstash/pipeline"

查看管方文档的pipelines.yml

  #唯一id(标识用的)
- pipeline.id: my-pipeline_1
  #指定对应conf文件
  path.config: "/etc/path/to/p1.config"
  - #开启线程数量
  pipeline.workers: 3

- pipeline.id: my-other-pipeline
  path.config: "/etc/different/path/p2.cfg"
  queue.type: persisted

该文件在YAML中格式化并包含一个字典列表,其中每个字典描述一个管道,每个键/值对指定该管道的设置。这个示例展示了两个不同的管道,它们由ID和配置路径描述,对于第一个管道,pipeline.workers的值被设置为3,而在另一个则启用持久队列特性,在pipelines.yml文件中未显式设置的设置值将退回到pipelines.yml设置文件中指定的默认值。

在没有参数的情况下启动Logstash时,它将读取pipelines.yml文件并实例化文件中指定的所有管道,另一方面,当你使用-e或-f时,Logstash会忽略pipelines.yml文件,并记录对此的警告。

注:配置pipelines.yml 文件后,无需再指定conf,直接启动即可
./bin/logstash

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

L-960

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值