logasth conf“输入部分”
input {
jdbc {
jdbc_driver_library => "/home/jskang/mongo-java-driver-3.2.2.jar"
jdbc_driver_class => "com.mongodb.MongoClient"
jdbc_connection_string => "jdbc:mongodb://localhost:27017/test"
jdbc_user => ""
statement => "db.noobject.find()"
}
}
并打印错误。
[错误][logstash.pipeline] 插件出现不可恢复的错误。将重新启动此插件。插件:“/home/jskang/mongo-java-driver-3.2.2.jar”,jdbc_driver_class=>“com.mongodb.MongoClient”,jdbc_connection_string=>“jdbc:mongodb://localhost:27017/test”,statement=>“db.noobject.find()”,id=>“df4ccfb18e5d04b6996063d547474649d5b7942a-1”,enable_metric=>true,codec=>“plain_d07acd49-a189-4c04-b8bf-7bae6f423c49”,enable_metric=>true,charset=>“UTF-8”>,jdbc_paging_enabled=>false,jdbc_page_size=>100000,jdbc_validate_connection=>false, jdbc_validation_timeout=>3600, jdbc_pool_timeout=>5, sql_log_level=>"info", connection_retry_attempts=>1, connection_retry_attempts_wait_time=>0.5, parameters=>{"sql_last_value"=>1970-01-01 00:00:00 UTC}, last_run_metadata_path=>"/home/jskang/.logstash_jdbc_last_run", use_column_value=>false, tracking_column_type=>"numeric", clean_run=>false, record_last_run=>true, lowercase_column_names=>true> 错误:Java::JavaSql::SQLException:未找到适合 jdbc:mongodb://localhost:27017/test 的驱动程序
为什么 logstash 无法启动!?我不知道…… :(
答案1
我遇到了同样类型的错误,然后重新安装了 mongo 的 jdbc 驱动程序并进行了如下配置,
jdbc {
jdbc_connection_string => "jdbc:mongo://xxx.xxx.xxx.xxx:27017/database"
jdbc_user => "user"
jdbc_password => "password"
jdbc_driver_library => "/etc/logstash/mongodb-java-driver-3.4.2.jar"
jdbc_driver_class => "com.mongodb.MongoClient"
statement => "SELECT * FROM table"
schedule => "*/30 * * * *"
tags => "mongodb"
}