我使用我自己配置的文件启动logstash报错

** 启动 sh logstash -f ../config/mysql.conf **

Sending Logstash logs to /media/tina/UNTITLED/software/es/logstash-7.6.2/logs which is now configured via log4j2.properties
[2020-11-30T16:27:54,311][WARN ][logstash.config.source.multilocal] Ignoring the 'pipelines.yml' file because modules or command line options are specified
[2020-11-30T16:27:54,386][INFO ][logstash.runner ] Starting Logstash {"logstash.version"=>"7.6.2"}
[2020-11-30T16:27:55,120][ERROR][logstash.agent ] Failed to execute action {:action=>LogStash::PipelineAction::Create/pipeline_id:main, :exception=>"LogStash::ConfigurationError", :message=>"Expected one of [ \t\r\n], "#", "{", "}" at line 27, column 20 (byte 856) after output {\n elasticsearch {\n # 数据查询\n statement => "select * from flowers\n # es主机和端口\n hosts => ["", :backtrace=>["/media/tina/UNTITLED/software/es/logstash-7.6.2/logstash-core/lib/logstash/compiler.rb:41:in compile_imperative'", "/media/tina/UNTITLED/software/es/logstash-7.6.2/logstash-core/lib/logstash/compiler.rb:49:in compile_graph'", "/media/tina/UNTITLED/software/es/logstash-7.6.2/logstash-core/lib/logstash/compiler.rb:11:in block in compile_sources'", "org/jruby/RubyArray.java:2580:in map'", "/media/tina/UNTITLED/software/es/logstash-7.6.2/logstash-core/lib/logstash/compiler.rb:10:in compile_sources'", "org/logstash/execution/AbstractPipelineExt.java:161:in initialize'", "org/logstash/execution/JavaBasePipelineExt.java:47:in initialize'", "/media/tina/UNTITLED/software/es/logstash-7.6.2/logstash-core/lib/logstash/java_pipeline.rb:27:in initialize'", "/media/tina/UNTITLED/software/es/logstash-7.6.2/logstash-core/lib/logstash/pipeline_action/create.rb:36:in execute'", "/media/tina/UNTITLED/software/es/logstash-7.6.2/logstash-core/lib/logstash/agent.rb:326:in block in converge_state'"]}
[2020-11-30T16:27:55,306][INFO ][logstash.agent ] Successfully started Logstash API endpoint {:port=>9600}
[2020-11-30T16:28:00,212][INFO ][logstash.runner ] Logstash shut down.

这是我的配置文件 驱动包已经在目录下面了
input {
jdbc {
# myslq驱动,已经放置到logstash的目录下
jdbc_driver_library => "../mysql-connector-java-8.0.16.jar"
# Mysql驱动类全类名,注意mysql8.x以上需要加cj
jdbc_driver_class => "com.mysql.cj.jdbc.Driver"
# mysql连接url
jdbc_connection_string => "jdbc:mysql://192.168.3.26:3306/tina_flowers"
# mysql 用户名
jdbc_user => "root"
# mysql 密码
jdbc_password => "123456"
# 设置定时任务,多久执行一次查询,默认一分钟,需要无延迟可使用schedule => "* * * * * "
schedule => "
* * * *"
# 清空上次的sql_last_value记录
clean_run => true
# 要执行的sql(同步)语句 and edit_time < now() order by edit_time desc
statement => "select * from flowers where edit_time >= :sql_last_value "
}
}

output {
elasticsearch {
# 数据查询
statement => "select * from flowers
# es主机和端口
hosts => ["127.0.0.1:19200"]
# 同步数据在ES的索引名称
index => "tina_index"
# es文档的id,表示使用mysql表的id
document_id => "%{id}"
}
}

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.