Not able to run ALTER query through logstash JDBC plugin

I am not able to run ALTER queries on my Oracle database through Logstash. Below is the snippet from the config file:

input {
    jdbc {
        jdbc_validate_connection => true
        jdbc_driver_library => "ojdbc7.jar"
        jdbc_driver_class => "Java::oracle.jdbc.OracleDriver"
        jdbc_connection_string => "jdbc:oracle:thin:@<hostname>:<port>/<SID>"
        jdbc_user => "username"
        jdbc_password => "password"
        schedule => "48 11 * * thu"
        statement => "ALTER INDEX <tablename> REBUILD ONLINE"
    }
}

Getting error:
Exception when executing JDBC query {:exception=>Java::JavaSql::SQLRecoverableException, :message=>"Closed Connection"}

The same config is working fine if I run a select query and I am able to see the logs in Kibana. Also, I am able to execute the ALTER query through SQL Developer tool with same user that I am passing here. So this means there's no access related issues.

Is this even possible to run ALTER queries through Logstash? Not sure what I am missing here. Any help on this is appreciated. Thanks in advance.

The jdbc input is meant to generate events from the database. Not to send admin commands. Why are you doing this?

Due to some technical constraint on the infra where my database is created, I am not able to run these queries in an automated way through tools like Jenkins.
That's when I thought of exploring Logstash to achieve this. This is one of the few options that I have in mind.

Is it not possible at all through Logstash?

That's not the tool for this IMHO. And I believe the error you are seeing here is similar to what you might be seeing from Jenkins or other tools like this.
You should better ask your DBA.

Thanks for the reply. I shall check for another approach.

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