原因分析:
logstash版本是7.3.0,采用的是tar.gz方式安装的,写了一个shell启动脚本:

#!/bin/bash

nohup /home/vdb1/elastic_cluster/logstash-7.3.0/bin/logstash -f /home/vdb1/elastic_cluster/logstash-7.3.0/config/logstash.conf >> /home/vdb1/elastic_cluster/logstash-7.3.0/logstash.log &

但是当在config/logstash.yml中开启X-Pack Management功能后,配置如下:

# logstash_user用户是手动创建的用户,并分配有俩角色,详见其他文章
xpack.management.enabled: true
xpack.management.pipeline.id: ["main", "apache_logs","my_apache_logs"]
xpack.management.elasticsearch.username: logstash_user
xpack.management.elasticsearch.password: escluter123456
xpack.management.elasticsearch.hosts: ["http://172.17.107.187:9201", "http://172.17.107.187:9202","http://172.17.107.187:9203"]

使用上述脚本启动logstsh会报错:

[2020-01-08T17:02:17,210][ERROR][logstash.configmanagement.bootstrapcheck] There are config files (1) in the '/home/vdb1/elastic_cluster/logstash-7.3.0/config/logstash.conf' folder. Elasticsearch is configured as the config store so configs cannot be sourced via the command line with -f or via logstash.yml with path.config
ERROR: There are config files (1) in the '/home/vdb1/elastic_cluster/logstash-7.3.0/config/logstash.conf' folder. Elasticsearch is configured as the config store so configs cannot be sourced via the command line with -f or via logstash.yml with path.config
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

大致含义是因为es的问题,导致logstash不能通过使用-f选项来指定配置文件

修改启动脚本如下:

#!/bin/bash

nohup /home/vdb1/elastic_cluster/logstash-7.3.0/bin/logstash  >> /home/vdb1/elastic_cluster/logstash-7.3.0/logstash.log &

顺利解决该问题

12-20 12:07
查看更多