Problem in query in logstash

input {
jdbc {
jdbc_driver_library => "XXXX"
jdbc_driver_class => "Java::oracle.jdbc.driver.OracleDriver"
jdbc_connection_string => "XXXX"
jdbc_user => "XXXX"
jdbc_password => "XXXX"
statement => "SELECT * FROM MONITORING_LOGS WHERE "time_stamp" >= SYSDATE - INTERVAL '5' MINUTE AND "module_id" = '1'"
jdbc_paging_enabled => true
jdbc_page_size => 10000
schedule => "*/5 * * * *"


i Have this query that I need to run in logstash but I get an sql error " bad statement"

Hi @Hind_Alla,

Welcome to the community! Have you checked your SQL against your DB first to validate the syntax? A SQL bad statement error is normally caused by an SQL syntax issue.

@carly.richmond yes I checked the sql in my db and it worked fine . I think maybe because of double quotes but I skipped it with backslash and it still didn't work

Thanks for confirming @Hind_Alla. I'm not sure if it's just the formatting here on discuss, but it could be the length of the query if it's overflowing onto another line in your file. Can you try the statement_filepath property and see if extracting the query to a separate file helps?

okey I'll try the stamement_filepath property and get back to you . Thank you @carly.richmond

Thank you @carly.richmond !!! It works perfectly. :smiley:

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.