问题遇到的现象和发生背景
大数据采集课程使用ELK工具中logstash的报错
用代码块功能插入代码,请勿粘贴截图
用终端运行logstash后报错
如下是我logstash想要运行的.conf文件
input {
jbdc{
jdbc_connection_string => "jdbc:mysql://localhost:3306/lab4"
jdbc_user => "root"
jdbc_password => "g"
jdbc_validate_connection => true
jdbc_driver_library => "D:\ELK\logstash-5.6.16\logstash-5.6.16\mysqltest\mysql-connector-java-8.0.22.jar"
jdbc_driver_class => "com.mysql.jdbc.Driver"
jdbc_paging_enabled => "true"
jdbc_page_size => "50000"
statement_filepath => "D:\ELK\logstash-5.6.16\logstash-5.6.16\mysqltest\test4.sql"
schedule => "* * * * *"
}
}
filter{
json{
source => "message"
remove_field => ["message"]
}
}
output {
elasticswarch {
hosts =>"http://localhost:9200"
index =>"index_test"
document_type => "_doc"
}
}
运行结果及报错内容
D:\ELK\logstash-5.6.16\logstash-5.6.16\bin>java -version
java version "1.8.0_201"
Java(TM) SE Runtime Environment (build 1.8.0_201-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.201-b09, mixed mode)
D:\ELK\logstash-5.6.16\logstash-5.6.16\bin>logstash.bat
NameError: cannot link Java class org.apache.logging.log4j.core.config.LoggerConfig needs Java 8 (java.lang.UnsupportedClassVersionError: org/logstash/log/LogstashLogEventFactory : Unsupported major.minor version 52.0)
get_proxy_or_package_under_package at org/jruby/javasupport/JavaUtilities.java:54
method_missing at file:/D:/ELK/logstash-5.6.16/logstash-5.6.16/vendor/jruby/lib/jruby.jar!/jruby/java/java_package_module_template.rb:14
Logging at D:/ELK/logstash-5.6.16/logstash-5.6.16/logstash -core/lib/logstash/logging/logger.rb:10
LogStash at D:/ELK/logstash-5.6.16/logstash-5.6.16/logstash -core/lib/logstash/logging/logger.rb:5
(root) at D:/ELK/logstash-5.6.16/logstash-5.6.16/logstash -core/lib/logstash/logging/logger.rb:4
require at org/jruby/RubyKernel.java:1040
(root) at D:/ELK/logstash-5.6.16/logstash-5.6.16/logstash -core/lib/logstash/util/loggable.rb:1
require at org/jruby/RubyKernel.java:1040
(root) at D:/ELK/logstash-5.6.16/logstash-5.6.16/logstash -core/lib/logstash/util/loggable.rb:2
require at org/jruby/RubyKernel.java:1040
(root) at D:/ELK/logstash-5.6.16/logstash-5.6.16/logstash -core/lib/logstash/settings.rb:1
require at org/jruby/RubyKernel.java:1040
(root) at D:/ELK/logstash-5.6.16/logstash-5.6.16/logstash -core/lib/logstash/settings.rb:2
require at org/jruby/RubyKernel.java:1040
(root) at D:\ELK\logstash-5.6.16\logstash-5.6.16\lib\bootstrap\environment.rb:70
我的解答思路和尝试过的方法
报错说是连接不上java 网上查询后有一条一模一样的问题,但是他是说jdk的版本不对要1.8以上的,然而我的jdk是1.8.0_201,并且我尝试换1.8.X其他版本的jdk后仍然这样报错。
我想要达到的结果
能够通过logstash将mysql或者csv文件传输到我的es上(能让我的logstash运行起来也好.)