我已经在 Ubuntu 14.10 上从官方 elasticsearch 存储库安装了 logstash。安装过程添加了 upstart 作业/etc/init/logstash.conf
和 init 脚本/etc/init.d/logstash
# logstash - agent instance
#
description "logstash agent"
start on virtual-filesystems
stop on runlevel [06]
# Respawn it if the process exits
respawn
# We're setting high here, we'll re-limit below.
limit nofile 65550 65550
setuid logstash
setgid logstash
# You need to chdir somewhere writable because logstash needs to unpack a few
# temporary files on startup.
console log
script
# Defaults
PATH=/bin:/usr/bin
LS_HOME=/var/lib/logstash
LS_HEAP_SIZE="500m"
LS_JAVA_OPTS="-Djava.io.tmpdir=${LS_HOME}"
LS_LOG_FILE=/var/log/logstash/logstash.log
LS_USE_GC_LOGGING=""
LS_CONF_DIR=/etc/logstash/conf.d
LS_OPEN_FILES=16384
LS_NICE=19
LS_OPTS=""
# Override our defaults with user defaults:
[ -f /etc/default/logstash ] && . /etc/default/logstash
HOME="${HOME:-$LS_HOME}"
JAVA_OPTS="${LS_JAVA_OPTS}"
# Reset filehandle limit
ulimit -n ${LS_OPEN_FILES}
cd "${LS_HOME}"
# Export variables
export PATH HOME JAVA_OPTS LS_HEAP_SIZE LS_JAVA_OPTS LS_USE_GC_LOGGING
test -n "${JAVACMD}" && export JAVACMD
exec nice -n ${LS_NICE} /opt/logstash/bin/logstash agent -f "${LS_CONF_DIR}" -l "${LS_LOG_FILE}" ${LS_OPTS}
end script
但是 logstash 代理不会在系统重启时自动启动。但如果我运行
initctl emit virtual-filesystems
代理立即启动。/var/log/upstart/logstash.log
不包含启动时的任何条目。
这是我的/etc/fstab
# <file system> <mount point> <type> <options> <dump> <pass>
/dev/sda2 / ext4 errors=remount-ro,relatime 0 1
/dev/sda3 /home ext4 defaults,relatime 1 2
/dev/sda4 swap swap defaults 0 0
/dev/sda5 /backup ext4 defaults,relatime 1 2
proc /proc proc defaults 0 0
sysfs /sys sysfs defaults 0 0
devtmpfs /dev devtmpfs rw 0 0
作业为何没有运行?
更新
当我将虚拟文件系统更改为文件系统时,它可以正确启动。
没有logstash.override
文件。udev
服务正在运行
root@pluto:~# ps aux | grep udev
root 329 0.0 0.0 24092 196 ? S 10:57 0:00 upstart-udev-bridge --daemon
root 356 0.0 0.0 34840 2984 ? Ss 10:57 0:00 /lib/systemd/systemd-udevd --daemon
root 11038 0.0 0.0 9948 2140 pts/4 D+ 12:19 0:00 grep --color=auto udev