My input looks like
input {
jdbc {
jdbc_connection_string => "jdbc:redshift://infa-iidiq-cluster-qa1.ctd4xsffelb3.us-west-2.redshift.amazonaws.com:5439/iidiqdatabase"
jdbc_user => ""
jdbc_password => ""
jdbc_validate_connection => true
jdbc_driver_library => "RedshiftJDBC42-1.2.10.1009.jar"
jdbc_driver_class => "com.amazon.redshift.jdbc42.Driver"
schedule => "*/3 * * * *"
statement => 'SELECT log_entry_id, CASE WHEN task_status = 'SUCCESS' THEN 'INFO' WHEN task_status = 'FAILED' THEN 'ERROR' WHEN task_status = 'WARNINGS' THEN 'WARN' END AS "log_level", 'activity' AS "log_type" FROM xyz.abc WHERE tracking_col >:sql_last_value ORDER BY tracking_col ASC'
use_column_value => true
tracking_column => tracking_col
last_run_metadata_path => "metadata/logstash_jdbc_last_run"
}
}
But due to usage of both " and ' plugin throwing error.
My SQL statement
SELECT log_entry_id,
CASE
WHEN task_status = 'SUCCESS'
THEN 'INFO'
WHEN task_status = 'FAILED'
THEN 'ERROR'
WHEN task_status = 'WARNINGS'
THEN 'WARN'
END AS "log_level",
'activity' AS "log_type"
FROM xyz.abc
WHERE tracking_col >:sql_last_value
ORDER BY tracking_col ASC
Any help will be appreciated.