logstash 开机自启动

环境

os: centos7.x
logstash release: 6.6.0
#logstash 解析某日志的配置文件所在目录
mkdir /opt/xxlog_ana_configdir
#此处使用官网提供的二进制压缩包安装
tar -xf logstash.tar.gz -C /usr/local/logstash
创建用户
useradd logstash -M -s /usr/sbin/nologin

修改启动配置项

cat /usr/local/logstash/config/startup.options
# Set a home directory
LS_HOME=/usr/local/logstash


# logstash settings directory, the path which contains logstash.yml
LS_SETTINGS_DIR=/usr/local/logstash/config

# Arguments to pass to logstash
LS_OPTS="--path.settings ${LS_SETTINGS_DIR} -f /opt/xxlog_ana_configdir --config.reload.automatic"
# 

# user and group id to be invoked as
LS_USER=logstash
LS_GROUP=logstash

生成启动文件

/usr/local/logstash/bin/system-install
#查看启动文件
cat /etc/systemd/system/logstash.service

systemctl start logstash
systemctl enable logstash

你可能感兴趣的:(logstash 开机自启动)