Get logstash version

How does one get the version of Logstash?

root@elk:/usr/share/elasticsearch# bin/logstash --help
bash: bin/logstash: No such file or directory

I have Logstash running on my system. Also.

root@elk:/# logstash -V
bash: logstash: command not found

Also.

root@elk:/# ps aux | grep logstash
logstash  1725 45.3  8.5 1942860 175936 ?      SNl  22:03   0:35 /usr/bin/java -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -Djava.awt.headless=true -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+HeapDumpOnOutOfMemoryError -Djava.io.tmpdir=/opt/logstash -Xmx500m -Xss2048k -Djffi.boot.library.path=/opt/logstash/vendor/jruby/lib/jni -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -Djava.awt.headless=true -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+HeapDumpOnOutOfMemoryError -Djava.io.tmpdir=/opt/logstash -XX:HeapDumpPath=/opt/logstash/heapdump.hprof -Xbootclasspath/a:/opt/logstash/vendor/jruby/lib/jruby.jar -classpath : -Djruby.home=/opt/logstash/vendor/jruby -Djruby.lib=/opt/logstash/vendor/jruby/lib -Djruby.script=jruby -Djruby.shell=/bin/sh org.jruby.Main --1.9 /opt/logstash/lib/bootstrap/environment.rb logstash/runner.rb agent -f /etc/logstash/conf.d -l /var/log/logstash/logstash.log
root      1777  0.0  0.0   8860   636 ?        S+   22:05   0:00 grep --color=auto logstash

More.

root@elk:/opt/logstash/bin# ls
logstash  logstash.bat  logstash.lib.sh  plugin  plugin.bat  rspec  rspec.bat  setup.bat
root@elk:/opt/logstash/bin# logstash -V
bash: logstash: command not found

Solution 1:

Logstash is one of those things that just doesn't quite live where you expect it to live, and the documentation is reallllly light (read: non-existent) on where they expect you to find things, so if you've installed it from a package then it can be nigh impossible to find the expected location documented. 1

Logstash typically lives in /opt/logstash and you can find the logstash binary in the bin folder (/opt/logstash/bin).

From there you can run -V or --version

./logstash -v

or

./logstash --version

From your comments on another answer, it would appear that this is in a docker container. This is the sort of thing you should really be including in your original question.

You will want to make use of docker exec. You will need to use docker ps to list your containers, and pass that through to your docker exec command.

For example:

docker exec -d elk_container /opt/logstash/bin/logstash --version

1I don't want this to be misconstrued. Logstash documentation is excellent - it's just the parts about where all the different bits are expected to live that's impossible to find

Solution 2:

On Logstash 5.x on CentOS/Red Hat:

Location of logstash binary: /usr/share/logstash/bin/

Then this will tell you the version: ./logstash -V

Solution 3:

Try find / -type f -name "logstash" 2>/dev/null to find logstash, it will take some time to return though.

Then with the location of logstash that you find, run the binary with the --version flag.