logstash 无法读取管道yaml文件

ua4mk5z4  于 2022-12-09  发布在  Logstash
关注(0)|答案(4)|浏览(727)

这里是我关于pipelines.yml文件的问题。首先,我正在使用Elasticsearch 6.6和Logstash 6.2.2。两者都安装在我自己的Google Cloud帐户的VM中(不是ELK提供的,而是在我自己的GCP帐户中的托管)。我有3个文件夹,其中来自IoT设备的日志文件来,只是想同时在3个相应的索引中插入它们,所以我在logstash/config路径中创建了一个pipelines.yml文件,包含以下内容:

-pipeline.id: pipeline1
 path.config: "/config/p1/logstash-learning.conf"
 pipeline.workers: 1
-pipeline.id: pipeline2
 path.config: "/config/p2/logstash-groundtruth.conf"
 pipeline.workers: 1
-pipeline.id: pipeline3
 path.config: "/config/p3/logstash-fieldtest.conf"
 pipeline.workers: 1

所以,当我用命令./bin/logstash运行logstash时(用这个命令我们告诉Logstash加载默认的文件pipelines.yml,对吗?),我得到了下面的错误消息,我不知道为什么会发生这种情况。注意pipelines.yml有完全的访问权限。

jruby: warning: unknown property jruby.regexp.interruptible
Sending Logstash's logs to /home/evangelos/logstash-6.2.2/logs which is now configured via log4j2.properties
[2019-12-17T16:36:43,877][INFO ][logstash.modules.scaffold] Initializing module {:module_name=>"netflow", :directory=>"/home/evangelos/logstash-6.2.2/modules/netflow/configuration"}
[2019-12-17T16:36:43,933][INFO ][logstash.modules.scaffold] Initializing module {:module_name=>"fb_apache", :directory=>"/home/evangelos/logstash-6.2.2/modules/fb_apache/configuration"}
ERROR: Failed to read pipelines yaml file. Location: /home/evangelos/logstash-6.2.2/config/pipelines.yml
usage:
  bin/logstash -f CONFIG_PATH [-t] [-r] [] [-w COUNT] [-l LOG]
  bin/logstash --modules MODULE_NAME [-M "MODULE_NAME.var.PLUGIN_TYPE.PLUGIN_NAME.VARIABLE_NAME=VALUE"] [-t] [-w COUNT] [-l LOG]
  bin/logstash -e CONFIG_STR [-t] [--log.level fatal|error|warn|info|debug|trace] [-w COUNT] [-l LOG]
  bin/logstash -i SHELL [--log.level fatal|error|warn|info|debug|trace]
  bin/logstash -V [--log.level fatal|error|warn|info|debug|trace]
  bin/logstash --help
[2019-12-17T16:36:45,347][ERROR][org.logstash.Logstash    ] java.lang.IllegalStateException: org.jruby.exceptions.RaiseException: (SystemExit) exit
u5i3ibmn

u5i3ibmn1#

最后,用http://www.yamllint.com/在线yaml测试仪测试出pipelines.yml的正确语法如下:

-
pipeline.id: pipeline1
 path.config: "/config/p1/logstash-learning.conf"
 pipeline.workers: 1

-
pipeline.id: pipeline2
 path.config: "/config/p2/logstash-groundtruth.conf"
 pipeline.workers: 1

-
pipeline.id: pipeline3
 path.config: "/config/p3/logstash-fieldtest.conf"
 pipeline.workers: 1
hyrbngr7

hyrbngr72#

是否更改了path.config中的路径?

-pipeline.id: pipeline1
 path.config: "/home/evangelos/logstash-6.2.2/pipelines/logstash-learning.conf"
 pipeline.workers: 1
-pipeline.id: pipeline2
 path.config: "/home/evangelos/logstash-6.2.2/pipelines/logstash-groundtruth.conf"
 pipeline.workers: 1
-pipeline.id: pipeline3
 path.config: "/home/evangelos/logstash-6.2.2/pipelines/logstash-fieldtest.conf"
 pipeline.workers: 1

在pipelines.yml文件中进行上述设置后,运行以下命令以运行管道,

bin/logstash --path.settings config/
46scxncf

46scxncf3#

请保持各管道之间的间距线如下。

-pipeline.id: pipeline1
 path.config: "/config/p1/logstash-learning.conf"
 pipeline.workers: 1

-pipeline.id: pipeline2
 path.config: "/config/p2/logstash-groundtruth.conf"
 pipeline.workers: 1

-pipeline.id: pipeline3
 path.config: "/config/p3/logstash-fieldtest.conf"
 pipeline.workers: 1
svdrlsy4

svdrlsy44#

删除path.config中的引号对我很有效:

-pipeline.id: pipeline1
 path.config: /config/p1/logstash-learning.conf
 pipeline.workers: 1

-pipeline.id: pipeline2
 path.config: /config/p2/logstash-groundtruth.conf
 pipeline.workers: 1

-pipeline.id: pipeline3
 path.config: /config/p3/logstash-fieldtest.conf
 pipeline.workers: 1

相关问题