I've recently installed logstash via the apt package repositories here: https://www.elastic.co/guide/en/logstash/current/package-repositories.html
I have also created my own configuration file, which processes some syslog-ng logs and parses them accordingly.
The issue is that for me to make logstash use that configuration file, I have to manually do it using the following command (while in the logstash directory):
bin/logstash -f logstash.conf
I've tried using a variety of init scripts such as the one shown here: https://gist.github.com/nodesocket/5941884 with no luck. Whenever I attempt to check the status of logstash ("sudo service logstash status"), I get the "logstash started" message but when I check again it says "logstash is not running".
I was just looking for a step by step guide on how to get it working from a fresh installation of logstash.
In /var/log/logstash/ there should be a set of logstash logs. Try looking through those to see what the actual error was.
bin/logstash -f logstash.conf --configtest
LS_USER=logstash
to LS_USER=root
I have the same problem before in Ubuntu 16.0.4. Maybe your problem was for java! I have installed java manually in /usr/local/java/.... but logstash by default read /usr/bin/java to use java.
check it with this command:
root@elk:~# which java
/usr/bin/java
if the result not /usr/bin/java do the following instruction:
wget http://url to jdk****.tar.gz
sudo mkdir /usr/lib/jvm
cd /usr/lib/jvm
sudo tar -xvzf ~/Downloads/jdk********.tar.gz
vi /etc/environment
Add this line to environment
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/jvm/jdk1.8.0_151/bin:/usr/lib/jvm/jdk1.8.0_151/db/bin:/usr/lib/jvm/jdk1.8.0_151/jre/bin"
J2SDKDIR="/usr/lib/jvm/jdk1.8.0_151"
J2REDIR="/usr/lib/jvm/jdk1.8.0_151/jre"
JAVA_HOME="/usr/lib/jvm/jdk1.8.0_151"
DERBY_HOME="/usr/lib/jvm/jdk1.8.0_151/db"
then save it and close. after that run this commands:
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.8.0_151/bin/java" 0
sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.8.0_151/bin/javac" 0
sudo update-alternatives --set java /usr/lib/jvm/jdk1.8.0_151/bin/java
sudo update-alternatives --set javac /usr/lib/jvm/jdk1.8.0_151/bin/javac
reboot
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.