Kibana 无法读取logstash中的CSV文件,因为它正在自行关闭

g6ll5ycj  于 2022-12-09  发布在  Kibana
关注(0)|答案(3)|浏览(233)

我有elasticsearch和Kibana是启动和运行,我想使用logstash读取日志,所以我已经通过csv文件作为输入在logstash.conf文件,但它不阅读日志和自动关闭。
这是我运行logstash命令的方式:

D:\logstash-8.1.0\bin>logstash -f "D:/logstash.conf"

日志存储.conf

input{
 file{
   path => "D:/unicorn.csv"
   start_position => beginning
 }
}
output{
  elasticsearch{
    hosts => "localhost:9200"
    index => "indexforlogstash"
}
stdout{}
}

下面是终端输出:

"Using bundled JDK: ."
OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and 
will likely be removed in a future release.
Sending Logstash logs to D:/logstash-8.1.0/logs which is now configured via log4j2.properties
[2022-03-16T12:59:47,905][INFO ][logstash.runner          ] Log4j configuration path used is: 
D:\logstash-8.1.0\config\log4j2.properties
[2022-03-16T12:59:47,938][WARN ][logstash.runner          ] The use of JAVA_HOME has been d 
deprecated. Logstash 8.0 and later ignores JAVA_HOME and uses the bundled JDK. Running 
Logstash with the bundled JDK is recommended. The bundled JDK has been verified to work with 
each specific version of Logstash, and generally provides best performance and reliability. If 
you have compelling reasons for using your own JDK (organizational-specific compliance 
requirements, for example), you can configure LS_JAVA_HOME to use that version instead.
[2022-03-16T12:59:47,942][INFO ][logstash.runner          ] Starting Logstash 
{"logstash.version"=>"8.1.0", "jruby.version"=>"jruby 9.2.20.1 (2.5.8) 2021-11-30 2a2962fbd1 
OpenJDK 64-Bit Server VM 11.0.13+8 on 11.0.13+8 +indy +jit [mswin32-x86_64]"}
[2022-03-16T12:59:47,947][INFO ][logstash.runner          ] JVM bootstrap flags: [-Xms1g, - 
Xmx1g, -XX:+UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, - 
XX:+UseCMSInitiatingOccupancyOnly, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, - 
Djruby.compile.invokedynamic=true, -Djruby.jit.threshold=0, -Djruby.regexp.interruptible=true, 
-XX:+HeapDumpOnOutOfMemoryError, -Djava.security.egd=file:/dev/urandom, - 
Dlog4j2.isThreadContextMapInheritable=true, --add-opens=java.base/java.security=ALL-UNNAMED, -- 
add-opens=java.base/java.io=ALL-UNNAMED, --add-opens=java.base/java.nio.channels=ALL-UNNAMED, - 
-add-opens=java.base/sun.nio.ch=ALL-UNNAMED, --add-opens=java.management/sun.management=ALL- 
UNNAMED]
 [2022-03-16T12:59:48,058][INFO ][logstash.settings        ] Creating directory 
 {:setting=>"path.queue", :path=>"D:/logstash-8.1.0/data/queue"}
 [2022-03-16T12:59:48,104][INFO ][logstash.settings        ] Creating directory 
 {:setting=>"path.dead_letter_queue", :path=>"D:/logstash-8.1.0/data/dead_letter_queue"}
 [2022-03-16T12:59:48,285][WARN ][logstash.config.source.multilocal] Ignoring the 
 'pipelines.yml' file because modules or command line options are specified
 [2022-03-16T12:59:48,347][INFO ][logstash.agent           ] No persistent UUID file found. 
 Generating new UUID {:uuid=>"84410117-2fa7-499b-b55a-43a29192540e", :path=>"D:/logstash- 
8.1.0/data/uuid"}
 [2022-03-16T12:59:55,063][ERROR][logstash.config.sourceloader] No configuration found in the 
 configured sources.
 [2022-03-16T12:59:55,424][INFO ][logstash.agent           ] Successfully started Logstash API 
 endpoint {:port=>9600, :ssl_enabled=>false}
 [2022-03-16T13:00:00,591][INFO ][logstash.runner          ] Logstash shut down.
 [2022-03-16T13:00:00,609][FATAL][org.logstash.Logstash    ] Logstash stopped processing 
 because of an error: (SystemExit) exit
 org.jruby.exceptions.SystemExit: (SystemExit) exit
    at org.jruby.RubyKernel.exit(org/jruby/RubyKernel.java:747) ~[jruby.jar:?]
    at org.jruby.RubyKernel.exit(org/jruby/RubyKernel.java:710) ~[jruby.jar:?]
    at D_3a_.logstash_minus_8_dot_1_dot_0.lib.bootstrap.environment.<main>(D:\logstash- 
8.1.0\lib\bootstrap\environment.rb:94) ~[?:?]

有人让我知道我做错了什么。

ahy6op9u

ahy6op9u1#

我认为错误是由于配置代码中的斜杠。

path => "D:\unicorn.csv"

同时执行

logstash -f "D:\logstash.conf"

我还建议使用下面的命令来检查代码中是否有任何语法错误
日志文件--配置测试和退出-f“D:\日志文件配置”
保持联系!谢谢!

n3h0vuf2

n3h0vuf22#

在输出字段中,您可以添加rubydebug来了解logstash解析为输入的输入。

output{stdout{
    codec => rubydebug
}

}

t30tvxxf

t30tvxxf3#

错误指出logstash无法在提供的位置找到配置。
要解决该错误,请执行以下步骤:
1.修改输入中的文件路径,如下所示

input{
     file{
       path => "D:\\unicorn.csv"
       start_position => beginning
     }
    }

1.还可以使用logstash运行以下配置

D:\logstash-8.1.0\bin>logstash -f "D:\\logstash.conf"

相关问题