mongodb - 为 mongodb 连接运行 logstash 时出错
问题描述
运行时出现此错误。我正在尝试在 mongodb 和 elasticsearch 之间添加连接。通过logstash添加数据进行持续监控。然后我们将添加到 Kibana。但是遇到这个错误,不知道是conf文件格式问题还是什么?
# bin/logstash -f /etc/logstash/conf.d/mongodata.conf --config.debug
OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.headius.backport9.modules.Modules (file:/usr/share/logstash/logstash-core/lib/jars/jruby-complete-9.2.11.1.jar) to method sun.nio.ch.NativeThread.signal(long)
WARNING: Please consider reporting this to the maintainers of com.headius.backport9.modules.Modules
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
WARNING: Could not find logstash.yml which is typically located in $LS_HOME/config or /etc/logstash. You can specify the path using --path.settings. Continuing using the defaults
Could not find log4j2 configuration at path /usr/share/logstash/config/log4j2.properties. Using default config which logs errors to the console
[WARN ] 2020-06-17 11:12:25.705 [main] runner - --config.debug was specified, but log.level was not set to 'debug'! No config info will be logged.
[WARN ] 2020-06-17 11:12:25.937 [LogStash::Runner] multilocal - Ignoring the 'pipelines.yml' file because modules or command line options are specified
[INFO ] 2020-06-17 11:12:25.939 [LogStash::Runner] runner - Starting Logstash {"logstash.version"=>"7.7.0"}
[ERROR] 2020-06-17 11:12:26.495 [Converge PipelineAction::Create<main>] agent - Failed to execute action {:action=>LogStash::PipelineAction::Create/pipeline_id:main, :exception=>"LogStash::ConfigurationError", :message=>"Expected one of [ \\t\\r\\n], \"#\", \"{\" at line 2, column 15 (byte 23) after input {\n \"uri\" ", :backtrace=>["/usr/share/logstash/logstash-core/lib/logstash/compiler.rb:58:in `compile_imperative'", "/usr/share/logstash/logstash-core/lib/logstash/compiler.rb:66:in `compile_graph'", "/usr/share/logstash/logstash-core/lib/logstash/compiler.rb:28:in `block in compile_sources'", "org/jruby/RubyArray.java:2577:in `map'", "/usr/share/logstash/logstash-core/lib/logstash/compiler.rb:27:in `compile_sources'", "org/logstash/execution/AbstractPipelineExt.java:181:in `initialize'", "org/logstash/execution/JavaBasePipelineExt.java:67:in `initialize'", "/usr/share/logstash/logstash-core/lib/logstash/java_pipeline.rb:43:in `initialize'", "/usr/share/logstash/logstash-core/lib/logstash/pipeline_action/create.rb:52:in `execute'", "/usr/share/logstash/logstash-core/lib/logstash/agent.rb:342:in `block in converge_state'"]}
[INFO ] 2020-06-17 11:12:26.649 [Api Webserver] agent - Successfully started Logstash API endpoint {:port=>9600}
[INFO ] 2020-06-17 11:12:31.694 [LogStash::Runner] runner - Logstash shut down.
这是我的conf文件:
input {
"uri" => "mongodb://liquid.nvidia.com:27017/"
"placeholder_db_dir" => "/opt/logstash-mongodb/"
"placeholder_db_name" => "logstash_sqlite.db"
"collection" => "global_queue_list"
"batch_size" => 5000
}
filter {
}
output {
stdout {
codec => rubydebug
}
elasticsearch {
"action" => "index"
"index" => "mongo_log_data"
"hosts" => ["localhost:9200"]
}
}
解决方案
您缺少mongodb
输入插件(请参见此处)
input {
mongodb {
"uri" => "mongodb://liquid.nvidia.com:27017/"
"placeholder_db_dir" => "/opt/logstash-mongodb/"
"placeholder_db_name" => "logstash_sqlite.db"
"collection" => "global_queue_list"
"batch_size" => 5000
}
}
推荐阅读
- webforms - 切换到另一个选项卡 Web 窗体后,RTE 控件意外清除
- java - 按下按钮后不显示活动,带有按钮的一次性活动
- html - 如何使用CSS定位内联两个块和它们之间具有静态宽度的跨度?
- c - 在 C 中调试二叉搜索树
- sql - SQL 将 table1 转换为 table2 而不使用动态 SQL 数据透视或硬编码查询
- java - PDFBox并排连接两个pdf优化磁盘空间
- android - 如何解决 Permission Denial:阅读 com.android.providers.downloads.DownloadStorageProvider
- c++ - 类字符串是否总是被初始化为空?
- javascript - 如果新用户加入了聊天 vue,js,如何更新图表?
- javascript - 从对象方法返回值