Logstash 5.1.1“错误的URI(不是URI?)”

时间:2016-12-30 06:38:43

标签: logstash logstash-configuration logstash-file

错误:

  

c:\ Program Files \ Logstash \ bin> logstash.bat -e'input {stdin {}}   输出{stdout {}}'发生意外错误! :错误=>糟糕的URI   (不是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:分裂   '“,”C:/ Program Files / Logstash / vendor / jruby / lib / ruby​​ /   1.9 / uri / common.rb:210:在解析'“,”C:/ Program Files / Logstash / vendor / jruby / lib / ruby​​ / 1.9 / uri / common.rb:747:   在解析'“,”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:   在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:   不执行'“,”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:在运行'“,”c:\ Program Files \ \ Logstash \ lib \ bootstrap中   \ environment.rb:71:in(root)'“]

3 个答案:

答案 0 :(得分:10)

您收到的错误是因为您在Program Files中运行logstash而logstash不能与文件夹名称中的空格一起使用。

您应该将logstash文件夹复制到另一个不包含空格的位置,然后从那里运行。

答案 1 :(得分:3)

我有同样的基本错误信息。

$ 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)'"]

原来logstash没有准备好处理名称中带空格的文件路径。好吧,在macOS上,我把它及其相关的弹性堆栈应用程序放在一个名为elastic stack的文件夹中(带有空格)。用下划线替换该空间工作正常。

路径变成了这样的东西。

~/Downloads/elastic_stack/

现在按预期启动。

答案 2 :(得分:2)

此错误在5.0.1及更高版本中开始发生。与此相关的logstash仓库中存在一个未解决的问题:Input file path sometimes does not resolve on Windows。您可以使用5.0.0版本,但不会修复此错误。