You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Logstash 8.12执行配置文件报'No config files found in path'错误求助

Logstash 8.12启动报错'No config files found in path'(7.17版本可正常运行)

环境与问题描述

  • Windows 10环境,使用Logstash 8.12.1执行配置文件时,出现No config files found in path错误
  • 相同配置文件在Logstash 7.17版本中可正常运行
  • Elasticsearch和Kibana已通过elasticsearch.bat、kibana.bat正常启动,目标是在Kibana控制台查看日志输出

执行命令与错误日志

执行命令:

logstash -f logstash-ShoppingMs.conf

错误日志输出:

Microsoft Windows [Version 10.0.22631.3155]
(c) Microsoft Corporation. All rights reserved.

E:\Programing Workspace\Java\ELK Stack\logstash-8.12.1\bin>logstash -f logstash-ShoppingMs.conf
"Using bundled JDK: E:\Programing Workspace\Java\ELK Stack\logstash-8.12.1\jdk\bin\java.exe"
E:/Programing Workspace/Java/ELK Stack/logstash-8.12.1/vendor/bundle/jruby/3.1.0/gems/concurrent-ruby-1.1.9/lib/concurrent-ruby/concurrent/executor/java_thread_pool_executor.rb:13: warning: method redefined; discarding old to_int
E:/Programing Workspace/Java/ELK Stack/logstash-8.12.1/vendor/bundle/jruby/3.1.0/gems/concurrent-ruby-1.1.9/lib/concurrent-ruby/concurrent/executor/java_thread_pool_executor.rb:13: warning: method redefined; discarding old to_f
Sending Logstash logs to E:/Programing Workspace/Java/ELK Stack/logstash-8.12.1/logs which is now configured via log4j2.properties
[2024-02-16T16:52:14,605][INFO ][logstash.runner          ] Log4j configuration path used is: E:\Programing Workspace\Java\ELK Stack\logstash-8.12.1\config\log4j2.properties
[2024-02-16T16:52:14,610][WARN ][logstash.runner          ] The use of JAVA_HOME has been 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.
[2024-02-16T16:52:14,611][INFO ][logstash.runner          ] Starting Logstash {"logstash.version"=>"8.12.1", "jruby.version"=>"jruby 9.4.5.0 (3.1.4) 2023-11-02 1abae2700f OpenJDK 64-Bit Server VM 17.0.10+7 on 17.0.10+7 +indy +jit [x86_64-mswin32]"}
[2024-02-16T16:52:14,613][INFO ][logstash.runner          ] JVM bootstrap flags: [-Xms1g, -Xmx1g, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djruby.compile.invokedynamic=true, -XX:+HeapDumpOnOutOfMemoryError, -Djava.security.egd=file:/dev/urandom, -Dlog4j2.isThreadContextMapInheritable=true, -Dlogstash.jackson.stream-read-constraints.max-string-length=200000000, -Dlogstash.jackson.stream-read-constraints.max-number-length=10000, -Djruby.regexp.interruptible=true, -Djdk.io.File.enableADS=true, --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED, --add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED, --add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED, --add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED, --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED, --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]
[2024-02-16T16:52:14,617][INFO ][logstash.runner          ] Jackson default value override `logstash.jackson.stream-read-constraints.max-string-length` configured to `200000000`
[2024-02-16T16:52:14,618][INFO ][logstash.runner          ] Jackson default value override `logstash.jackson.stream-read-constraints.max-number-length` configured to `10000`
[2024-02-16T16:52:14,679][WARN ][logstash.config.source.multilocal] Ignoring the 'pipelines.yml' file because modules or command line options are specified
[2024-02-16T16:52:16,381][INFO ][logstash.config.source.local.configpathloader] No config files found in path {:path=>"E:/Programing Workspace/Java/ELK Stack/logstash-8.12.1/logstash-ShoppingMs.conf"}
[2024-02-16T16:52:16,383][ERROR][logstash.config.sourceloader] No configuration found in the configured sources.
[2024-02-16T16:52:16,535][INFO ][logstash.agent           ] Successfully started Logstash API endpoint {:port=>9600, :ssl_enabled=>false}
[2024-02-16T16:52:16,551][INFO ][logstash.runner          ] Logstash shut down.
[2024-02-16T16:52:16,558][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:808) ~[jruby.jar:?]
        at org.jruby.RubyKernel.exit(org/jruby/RubyKernel.java:767) ~[jruby.jar:?]
        at E_3a_.Programing_20_Workspace.Java.ELK_20_Stack.logstash_minus_8_dot_12_dot_1.lib.bootstrap.environment.<main>(E:\Programing Workspace\Java\ELK Stack\logstash-8.12.1\lib\bootstrap\environment.rb:90) ~[?:?]

配置文件内容

配置文件logstash-ShoppingMs.conf位于E:/Programing Workspace/Java/ELK Stack/logstash-8.12.1/bin/目录下,内容如下:

input {
  file {
    path => "e:/Programing Workspace/Java/ELK Stack/eureka_elk_log2.txt"
    start_position => "beginning"
  }
  file {
    path => "e:/Programing Workspace/Java/ELK Stack/billing_elk_log1.txt"
    start_position => "beginning"
  } 
  file {
    path => "e:/Programing Workspace/Java/ELK Stack/shopping_elk_log3.txt"
    start_position => "beginning"
  }
}
output {
  elasticsearch {
    hosts => ["localhost:9200"]
  }
  stdout { codec => rubydebug }
}

排查解决方案

1. 修正配置文件路径

从错误日志可见,Logstash在logstash-8.12.1根目录而非bin目录下查找配置文件,需指定正确路径:

  • 使用相对路径执行:
    logstash -f ./logstash-ShoppingMs.conf
    
  • 或使用完整绝对路径:
    logstash -f "E:/Programing Workspace/Java/ELK Stack/logstash-8.12.1/bin/logstash-ShoppingMs.conf"
    
  • Windows下也可尝试双反斜杠路径:
    logstash -f "E:\\Programing Workspace\\Java\\ELK Stack\\logstash-8.12.1\\bin\\logstash-ShoppingMs.conf"
    

2. 检查文件与权限

  • 执行dir logstash-ShoppingMs.conf在当前bin目录下确认文件存在
  • 检查Windows文件后缀是否隐藏:确保文件实际不是logstash-ShoppingMs.conf.txt(可在文件夹选项中开启"显示已知文件类型的扩展名"验证)
  • 确认Logstash进程对配置文件有读取权限

3. 利用Logstash配置检查工具

执行配置验证命令,获取更详细的错误提示:

logstash -f ./logstash-ShoppingMs.conf --config.test_and_exit

4. 适配Logstash 8.x特性

  • 8.x版本默认忽略JAVA_HOME,使用内置JDK,无需额外配置JAVA_HOME
  • 若需自定义JDK,需配置LS_JAVA_HOME环境变量而非JAVA_HOME

内容的提问来源于stack exchange,提问作者PrateekAnand

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.29 20:00:21