I'm using a JDBC input plugin (for sql server connection) in my logstash and having a issue on statement.
The error displayed is:
Java::ComMicrosoftSqlserverJdbc::SQLServerException: Incorrect syntax near 'ATUALIZADO\'.: SELECT TOP (1) count(*) AS [COUNT] FROM (SELECT CASE WHEN datediff("DAY",last_successful_load,getdate()) = 0 THEN \'ATUALIZADO\' ELSE \'ERRO\' END AS "status" FROM [analytics].[status]) AS [T1]
My config on logstash is the follows:
jdbc {
jdbc_driver_library => "/opt/jdbc_drivers/sqljdbc_12.6/ptb/jars/mssql-jdbc-12.6.1.jre11.jar"
jdbc_driver_class => "com.microsoft.sqlserver.jdbc.SQLServerDriver"
jdbc_connection_string => "jdbc:sqlserver://teste-xxx.database.windows.net:1433;databaseName=xxx_xCO"
jdbc_user => "user_xxx"
jdbc_password => "pass_xxx"
jdbc_paging_enabled => true
tracking_column => "unix_ts_in_secs"
use_column_value => true
tracking_column_type => "numeric"
schedule => "* */1 * * * *"
statement => 'SELECT CASE WHEN datediff("DAY",last_successful_load,getdate()) = 0 THEN \'ATUALIZADO\' ELSE \'ERRO\' END AS "status" FROM [analytics].[status]'
tags => "xxx"
}
I'm not sure if the single quotes are being escaped.
When i run the sql on the management studio with only single quotes (not escapes) it works successful.
Can anyone help me with that?