关于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