Hi,
Trying to connect to a local MySql db using jdbc_streaming filter but receiving below error.
[ERROR] 2019-08-02 08:46:51.709 [[main]-pipeline-manager] pipeline - Error registering plugin {:pipeline_id=>"main", :plugin=>"#<LogStash::FilterDelegator:0x1afd0eca>", :error=>"Sequel::DatabaseError: driver.new.connect returned nil: probably bad JDBC connection string",
This is my filter configuration for Logstash 6.8.1.
filter {
jdbc_streaming {
jdbc_driver_library => "/usr/share/java/mysql-connector-java.jar"
jdbc_driver_class => "com.mysql.jdbc.Driver"
jdbc_connection_string => "jdbc:mysql:/var/lib/mysql/sensor_metadata"
jdbc_user => "sample"
jdbc_password => "password"
statement => "select st.sensor_type as sensorType, l.customer as customer, l.department as department, l.building_name as buildingName, l.room as room, l.floor as floor, l.location_on_floor as locationOnFloor, l.latitude, l.longitude from sensors s inner join sensor_type st on s.sensor_type_id=st.sensor_type_id inner join location l on s.location_id=l.location_id where s.sensor_id= :sensor_identifier"
parameters => { "sensor_identifier" => "sensor_id"}
target => lookupResult
}
mutate {
rename => {"[lookupResult][0][sensorType]" => "sensorType"}
rename => {"[lookupResult][0][customer]" => "customer"}
rename => {"[lookupResult][0][department]" => "department"}
rename => {"[lookupResult][0][buildingName]" => "buildingName"}
rename => {"[lookupResult][0][room]" => "room"}
rename => {"[lookupResult][0][floor]" => "floor"}
rename => {"[lookupResult][0][locationOnFloor]" => "locationOnFloor"}
add_field => {
"location" => "%{[lookupResult][0][latitude]},%{[lookupResult][0][longitude]}"
}
remove_field => ["lookupResult", "headers", "host"]
}
}
Can someone please help me
Thank you!