after a long time, getting the plugin starts... it can't resolve the actual values from the derby DB!
local_lookups => [ { id => "get-status" query => "SELECT name from localstatus WHERE id = :stID" parameters => {stID => "[statusID]"} target => "statusdata" } ]
I got this in the logstash logs:
[2019-01-16T23:54:23,503][DEBUG][logstash.filters.jdbc.lookup] Executing Jdbc query {:lookup_id=>"get-status", :statement=>"SELECT name from localstatus WHERE id = :statusID", :parameters=>{:statusID=>"1"}}
[2019-01-16T23:54:23,504][WARN ][logstash.filters.jdbc.lookup] Exception when executing Jdbc query {:lookup_id=>"get-status", :exception=>"Java::JavaSql::SQLSyntaxErrorException: Comparisons between 'INTEGER' and 'CHAR (UCS_BASIC)' are not supported. Types must be comparable. String types must also have matching collation. If collation does not match, a possible solution is to cast operands to force them to the default collation (e.g. SELECT tablename FROM sys.systables WHERE CAST(tablename AS VARCHAR(128)) = 'T1')", :backtrace=>["org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(org/apache/derby/impl/jdbc/SQLExceptionFactory)", "org.apache.derby.impl.jdbc.Util.generateCsSQLException(org/apache/derby/impl/jdbc/Util)", "org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(org/apache/derby/impl/jdbc/TransactionResourceImpl)", "org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(org/apache/derby/impl/jdbc/TransactionResourceImpl)", "org.apache.derby.impl.jdbc.EmbedConnection.handleException(org/apache/derby/impl/jdbc/EmbedConnection)", "org.apache.derby.impl.jdbc.ConnectionChild.handleException(org/apache/derby/impl/jdbc/ConnectionChild)", "org.apache.derby.impl.jdbc.EmbedStatement.execute(org/apache/derby/impl/jdbc/EmbedStatement)", "org.apache.derby.impl.jdbc.EmbedStatement.executeQuery(org/apache/derby/impl/jdbc/EmbedStatement)"]}
When I manually set the query statement to:
query => "SELECT name from localstatus WHERE id = 1"
it returns what is should return!
Here is the tables:
local_db_objects => [
{
name => "localstatus"
index_columns => ["id"]
columns => [
["id", "int"],
["name", "varchar(255)"]
]
}
]
loaders => [{
id => "get-status"
query => "SELECT id, name FROM status ORDER BY id"
local_table => "localstatus"
}
]
logstash version: docker.elastic.co/logstash/logstash:6.5.4
with mysql driver:
jdbc_driver_class => "com.mysql.jdbc.Driver"
jdbc_driver_library => "/usr/share/logstash/config/jlib/mysql-connector-java-5.1.47.jar"