In the Elastic documentation for installing Logstash, it was mentioned that Logstash requires Java 8.
Logstash requires Java 8. Java 9 is not supported. Use the official Oracle distribution or an open-source distribution such as OpenJDK.
You can download Java 8 and try again. Hope it helps.
$ java -version
java version "1.8.0_171"
Java(TM) SE Runtime Environment (build 1.8.0_171-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.171-b11, mixed mode)
$ ./bin/logstash -f logstash.conf
Sending Logstash's logs to ...