按照 CentOS下ELK开机自启动的配置 设置好ELK的开机启动。
但是我这里使用的EKB,需要设置filebeat的开机启动,照着格式写了一个filebeat的启动:
#!/bin/bash
# chkconfig: 2345 90 10
# description: filebeat
FB_HOME=/usr/local/ELK/filebeat-5.6.3-linux-x86_64
case $1 in
start) sudo -iu hadoop $FB_HOME/filebeat&;;
*) echo "filebeat start" ;;
esac
平时是在filebeat目录下直接这样执行,而放到这里启动服务就报错了:
filebeat2017/11/14 08:21:04.181378 beat.go:346: CRIT Exiting: error loading config file: stat filebeat.yml: no such file or directory
Exiting: error loading config file: stat filebeat.yml: no such file or directory
说找不到配置文件,然后看了下启动filebeat的帮助:
flag provided but not defined: -f
Usage of ./filebeat-5.6.3-linux-x86_64/filebeat:
-E value
Configuration overwrite (default null)
-M value
Module configuration overwrite (default null)
-N Disable actual publishing for testing
-c value
Configuration file, relative to path.config (default filebeat.yml)
-configtest
Test configuration and exit.
-cpuprofile string
Write cpu profile to file
-d string
Enable certain debug selectors
-e Log to stderr and disable syslog/file output
-httpprof string
Start pprof http server
-memprofile string
Write memory profile to this file
-modules string
List of enabled modules (comma separated)
-once
Run filebeat only once until all harvesters reach EOF
-path.config value
Configuration path
-path.data value
Data path
-path.home value
Home path
-path.logs value
Logs path
-setup
Load the sample Kibana dashboards
-strict.perms
Strict permission checking on config files (default true)
-v Log at INFO level
-version
Print the version and exit
-c可以指定filebeat的配置文件。因此修改filebeat的启动文件内容为:
#!/bin/bash
# chkconfig: 2345 90 10
# description: filebeat
FB_HOME=/usr/local/ELK/filebeat-5.6.3-linux-x86_64
case $1 in
start) sudo -iu hadoop $FB_HOME/filebeat -c $FB_HOME/filebeat/filebeat.yml&;;
*) echo "filebeat start" ;;
esac
$FB_HOME/filebeat/filebeat.yml
这里写配置文件的路径,设置成功.