2
votes

Error:

c: \ Program Files \ Logstash \ bin> logstash.bat -e 'input {stdin {}} output {stdout {}}' An unexpected error occurred! : Error => bad URI (is not URI?): File: // c: / Program Files / Logstash / confi g / log4j2.properties,: backtrace => [ "C: / Program Files / Logstash / vendor / jruby / lib / ruby ​​/ 1.9 / uri / common. rb: 176: in split '", "C: / Program Files / Logstash / vendor / jruby / lib / ruby ​​/ 1.9 / uri / common.rb: 210: in parse ' "," C: / Program Files / Logstash / vendor / jruby / lib / ruby ​​/ 1.9 / uri / common.rb: 747: in parse'", "C: / Program Files / Logstash / vendor / jruby / lib / ruby ​​/ 1.9 / uri / common.rb: 994: inURI '", "c: / Program Files / Logstash / log stash-core / lib / logstash / logging / logger.rb: 76: in initialize '", "org / jruby / ext / thread / Mutex.java: 149: insynchronize '", "c: / Program Files / Logstash / logstash-core / lib / logstash / logging / logger.rb: 74: inin itialize ' "," c: / Program Files / Logstash / logstash-core / lib / logstash / runner.rb: 193: inexecute'", "c: / P rogram Files / Logstash / vendor / bundle / jruby / 1.9 / gems / clamp-0.6.5 / lib / clamp / command.rb: 67: in run '", "c : / Program Files / Logstash / logstash-core / lib / logstash / runner.rb: 178: inrun '", "c: / Program Files / Logst ash / vendor / bundle / jruby / 1.9 / gems / clamp-0.6.5 / lib / clamp / command.rb: 132: in run '", "c: \ Program Files \ \ Logstash \ lib \ bootstrap \ environment.rb: 71: in(root) '"]

3
You might have go on a tour here first.Kulasangar

3 Answers

10
votes

The error that you are getting is because you are running logstash in Program Files and logstash doesn't work with the space in the folder name.

You should copy the logstash folder to another location that doesn't contain a space and run it from there.

3
votes

I had the same fundamental error message.

$ bin/logstash -f sample.conf
An unexpected error occurred! :error => bad URI(is not URI?): file:///Users/user_name/Downloads/elastic stack/logstash-5.1.1/config/log4j2.properties, :backtrace => ["/Users/user_name/Downloads/elastic stack/logstash-5.1.1/vendor/jruby/lib/ruby/1.9/uri/common.rb:176:in `split'", "/Users/user_name/Downloads/elastic stack/logstash-5.1.1/vendor/jruby/lib/ruby/1.9/uri/common.rb:210:in `parse'", "/Users/user_name/Downloads/elastic stack/logstash-5.1.1/vendor/jruby/lib/ruby/1.9/uri/common.rb:747:in `parse'", "/Users/user_name/Downloads/elastic stack/logstash-5.1.1/vendor/jruby/lib/ruby/1.9/uri/common.rb:994:in `URI'", "/Users/user_name/Downloads/elastic stack/logstash-5.1.1/logstash-core/lib/logstash/logging/logger.rb:76:in `initialize'", "org/jruby/ext/thread/Mutex.java:149:in `synchronize'", "/Users/user_name/Downloads/elastic stack/logstash-5.1.1/logstash-core/lib/logstash/logging/logger.rb:74:in `initialize'", "/Users/user_name/Downloads/elastic stack/logstash-5.1.1/logstash-core/lib/logstash/runner.rb:193:in `execute'", "/Users/user_name/Downloads/elastic stack/logstash-5.1.1/vendor/bundle/jruby/1.9/gems/clamp-0.6.5/lib/clamp/command.rb:67:in `run'", "/Users/user_name/Downloads/elastic stack/logstash-5.1.1/logstash-core/lib/logstash/runner.rb:178:in `run'", "/Users/user_name/Downloads/elastic stack/logstash-5.1.1/vendor/bundle/jruby/1.9/gems/clamp-0.6.5/lib/clamp/command.rb:132:in `run'", "/Users/user_name/Downloads/elastic stack/logstash-5.1.1/lib/bootstrap/environment.rb:71:in `(root)'"]

Turns out logstash isn't prepared to handle file paths with spaces in the names. Well, on macOS, I had placed it and its associated elastic stack apps in a folder named elastic stack (with the space). Replacing that space with an underscore worked fine.

Path became something like this instead.

~/Downloads/elastic_stack/

Now it launches as expected.

2
votes

This error began to happen in the 5.0.1 and later versions. There is an open issue in the logstash repo related to this: Input file path sometimes does not resolve on Windows. You can use the 5.0.0 version while this error is not fixed.