15

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
Karl Morrison
  • 1,521
  • 4
  • 25
  • 42

9 Answers9

25

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

Mark Henderson
  • 68,316
  • 31
  • 175
  • 255
  • 1
    THANK YOU! I see the elitist gang are down voting you also! I'm trying to learn the ropes here but as you said and I completely agree with you, the documentation *is incredibly poor (in this area)*. I updated the question with more output from the console! – Karl Morrison Feb 24 '16 at 22:26
  • @KarlMorrison You need to do `./logstash`, or use the full path as I've put in my answer. – Mark Henderson Feb 24 '16 at 22:27
  • 1
    Took around 20 seconds but the command `root@elk:/opt/logstash/bin# ./logstash --version` did the trick! Thank you! I did upvote but someone apparently downvoted you (?). – Karl Morrison Feb 24 '16 at 22:32
  • @KarlMorrison meh, I'll live. I don't help explicitly for upvotes. In this case I've shed blood and tears over Elastic Search and Logstash in the past 2 weeks so I feel your pain intimately. – Mark Henderson Feb 24 '16 at 22:34
  • 2
    @KarlMorrison Calling people "the elitist gang" is not helping you. The original revision of your question looked the same as many other questions we get from people expecting us to do their research for them. It did not indicate that you _had_ tried to read the documentation. And /opt is one of the obvious places to look for things... – Michael Hampton Feb 24 '16 at 22:35
  • 1
    Well it's my term for individuals who do no good to the stack exchange community (the worst are by far over at mathmatics). Yeah I've been at the documentation for about three days now, before Logstash I was suffering with Sensu. I do always update my questions after more info if needed. Also as I'm not a sysadmin I sometimes don't really know what to include in the question to make it easier, when people ask of course I add more info. However I don't take closing the topic without reason nor posting mocking answers lightly though. Will leave you to it now, thanks again! – Karl Morrison Feb 24 '16 at 22:44
8

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

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.

Douglas P.
  • 71
  • 2
1

My logstash on Linux 17.04, logstash was found at: /usr/share/logstash. However, the config files are found at /etc/logstash. I had to copy over the config files to the new location: /usr/share/logstash/config to get logstash to work.

HBruijn
  • 72,524
  • 21
  • 127
  • 192
Julian
  • 11
  • 1
0

From the documentation:

-V, --version Display the version of Logstash.

(which took me all of about 30 seconds to find, by the way)

EEAA
  • 108,414
  • 18
  • 172
  • 242
  • 1
    Doh. Updated the question. – Karl Morrison Feb 24 '16 at 21:58
  • As Michael commented above, talk with whomever installed logstash. – EEAA Feb 24 '16 at 21:59
  • 1
    It's from a rather complicated Dockerfile which I do not have time to decode and learn about, I'm busy working... – Karl Morrison Feb 24 '16 at 22:01
  • 3
    Right, and part of your job is to figure out things like this. How are we supposed to know where logstash is installed **in your specific environment**? – EEAA Feb 24 '16 at 22:01
  • 1
    I'm a software engineer/computer scientist. Anyhows Mark answered perfectly and improved this community. (Stupid questions will continue to come until they are answered somehow, via better documentation or people like Mark, just saying) – Karl Morrison Feb 24 '16 at 22:36
  • 1
    @KarlMorrison I understand that you're a "software engineer/computer scientist". So am I. You are performing systems administration tasks, though, which makes this sort of thing part of your job. We have an expectation for people asking questions that they do their own research. Coming here to ask about logstash, and not having a clue about where it's installed fails the "research" test. – EEAA Feb 24 '16 at 22:38
  • 1
    If the documentation was better, then there would be no need for questions like mine. I don't come running to server fault first thing, *I come here last*. – Karl Morrison Feb 24 '16 at 22:49
  • Link to doc broken? – JohnZaj Aug 21 '17 at 23:30
0

Firstly, you'll need to find the path to logstash. Try searching for it by running updatedb && locate logstash/bin. I found mine in /usr/share/logstash/bin.

Running logstash with the "-v" or "--version" flags should return the version.

-1

ubuntu 20.04 server

root@server:/usr/share/logstash/bin# ./logstash --version

Using bundled JDK: /usr/share/logstash/jdk

logstash 7.11.0
Andrew Schulman
  • 8,561
  • 21
  • 31
  • 47
Sloomy
  • 1
-1

To check logstash version from server run below command: cd /usr/share/logstash; ./bin/logstash -V

-3

Logstash keeps its version identity in a ruby file i.e version.rb In Ubuntu, you can find version file at following location. So,use this cat /opt/logstash/lib/logstash/version.rb