Logstash | ConfigurationError:message=>第1行第1列(字节1)处的[\\t\\r\\n]、\“\”、\“input\”、\“filter\”、\“output\”中应有一个

Logstash | ConfigurationError:message=>第1行第1列(字节1)处的[\\t\\r\\n]、\“\”、\“input\”、\“filter\”、\“output\”中应有一个,configuration,logstash,elastic-stack,elk,Configuration,Logstash,Elastic Stack,Elk,启动Logstash时出现配置错误。我使用的是7.5.1版本。 相同的配置文件在前面工作过。我不得不在另一个虚拟机上设置麋鹿储藏,因为旧的虚拟机已经退役,我在这里面临这个错误 我正在使用- logstash-7.5.1\bin\logstash-f logstash-config.conf 配置文件- 我的错。配置文件中有一些错误字符。我只是需要清理一下。 在另一个文件上手动输入相同的配置内容是有效的。我在使用记事本++的Windows上遇到过同样的问题 我的解决方案是将配置保存到UTF-8,

启动Logstash时出现配置错误。我使用的是7.5.1版本。 相同的配置文件在前面工作过。我不得不在另一个虚拟机上设置麋鹿储藏,因为旧的虚拟机已经退役,我在这里面临这个错误

我正在使用-

logstash-7.5.1\bin\logstash-f logstash-config.conf

配置文件-


我的错。配置文件中有一些错误字符。我只是需要清理一下。
在另一个文件上手动输入相同的配置内容是有效的。

我在使用记事本++的Windows上遇到过同样的问题


我的解决方案是将配置保存到UTF-8,而不使用BOM和Unix格式LF。

当从网页复制/粘贴配置文件中的一些字符串时,我也遇到了同样的问题。 原因是在行首有除制表符或空格以外的不可打印字符。如果在VS代码中选择文件的全部内容,则可以看到好行和坏行之间的差异


我将坏字符替换为空格,问题就解决了。

哪些坏字符?我自己也有点受不了这个问题。在Windows机器上从头开始输入内容对我来说很有效。您可以使用sed或dos2unix命令使用unix系统清理文件,然后将其放置。谢谢。我的问题略有不同。我只使用linux,所以dos2unix的东西帮不上忙。事实证明,在YAML文件中不能有注释。让我哑口无言。这个信息仍然相当隐晦。
#config file

input{
jdbc{
jdbc_driver_library=>"C:\software\ojdbc7.jar"
jdbc_driver_class=>"Java::oracle.jdbc.driver.OracleDriver"
jdbc_connection_string=>"jdbc:oracle:thin:@<host>:1528:TSTIM"
jdbc_user=>"UName"
jdbc_password=>"PWD"
statement=>"SELECT * from TABLE where run_id > 4500"
}
}

output{
elasticsearch{
hosts=>"http://localhost:9200"
index=>"run_id"
document_type=>"TABLEname"
document_id=>"run_id"
user=>"elastic"
password=>"changeme"
}
stdout{
codec=>rubydebug
}
}
C:\software>logstash-7.5.1\bin\logstash -f logstash-config.conf
Thread.exclusive is deprecated, use Thread::Mutex
Sending Logstash logs to C:/software/logstash-7.5.1/logs which is now configured via log4j2.properties
[2020-01-08T05:04:33,207][WARN ][logstash.config.source.multilocal] Ignoring the 'pipelines.yml' file because modules or command line options are specified
[2020-01-08T05:04:33,426][INFO ][logstash.runner ] Starting Logstash {"logstash.version"=>"7.5.1"}
[2020-01-08T05:04:34,869][ERROR][logstash.agent ] Failed to execute action 
{:action=>LogStash::PipelineAction::Create/pipeline_id:main,
:exception=>"LogStash::ConfigurationError",
:message=>"Expected one of [ \t\r\n], "#", "input", "filter", "output" at line 1, column 1 (byte 1)", 
:backtrace=>[
"C:/software/logstash-7.5.1/logstash-core/lib/logstash/compiler.rb:41:in compile_imperative'",
"C:/software/logstash-7.5.1/logstash-core/lib/logstash/compiler.rb:49:in compile_graph'",
"C:/software/logstash-7.5.1/logstash-core/lib/logstash/compiler.rb:11:in block in compile_sources'",
"org/jruby/RubyArray.java:2584:in map'",
"C:/software/logstash-7.5.1/logstash-core/lib/logstash/compiler.rb:10:in compile_sources'", 
"org/logstash/execution/AbstractPipelineExt.java:156:in initialize'",
"org/logstash/execution/JavaBasePipelineExt.java:47:in initialize'", 
"C:/software/logstash-7.5.1/logstash-core/lib/logstash/java_pipeline.rb:27:in initialize'", 
"C:/software/logstash-7.5.1/logstash-core/lib/logstash/pipeline_action/create.rb:36:in execute'", 
"C:/software/logstash-7.5.1/logstash-core/lib/logstash/agent.rb:326:in block in converge_state'"
]}
[2020-01-08T05:04:35,510][INFO ][logstash.agent ] Successfully started Logstash API endpoint {:port=>9600}
[2020-01-08T05:04:40,325][INFO ][logstash.runner ] Logstash shut down.