Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CQL Error running Logstash with JDBC #161

Closed
brantkev opened this issue Sep 6, 2016 · 3 comments
Closed

CQL Error running Logstash with JDBC #161

brantkev opened this issue Sep 6, 2016 · 3 comments

Comments

@brantkev
Copy link

brantkev commented Sep 6, 2016

When executing Logstash with JDBC for Cassandra I am getting the error below

Java::ComDatastaxDriverCoreExceptions::SyntaxError: line 1:174 missing EOF at ')' (....logs_all_3_0_0 where event_id > '1970-01-01 00:00:00.000000'[)] AS...): SELECT count(*) AS "COUNT" FROM (select event_id, event_name, machine_name, payload from adamtestlog.logs_all_3_0_0 where event_id > '1970-01-01 00:00:00.000000') AS "T1" LIMIT 1 {:level=>:error, :file=>"sequel/database/logging.rb", :line=>"87", :method=>"lo
Exception when executing JDBC query {:exception=>#<Sequel::DatabaseError: Java::ComDatastaxDriverCoreExceptions::SyntaxError: line 1:174 missing EOF at ')' (....logs_all_3_0_0 where event_id > '1970-01-01 00:0[)] AS...)>, :level=>:warn, :file=>"logstash/plugin_mixins/jdbc.rb", :line=>"219", :method=>"execute_statement"}

The config file is as follows:

input {
jdbc {
jdbc_driver_library => "/opt/logstash/bin/jdbc-jar/cassandrajdbc1.1.jar"
jdbc_driver_class => "com.dbschema.CassandraJdbcDriver"
jdbc_connection_string => "jdbc:cassandra://172.30.0.96:9042/"
jdbc_user => "*_"
jdbc_password => "_
"
schedule => "
* * * *"
use_column_value => true
tracking_column => "event_id"
last_run_metadata_path => "/.logstash_jdbc_last_run"
statement => "select event_id, recorded_on, event_name, machine_name, payload from adamtestlog.logs_all_3_0_0 where event_id > :sql_last_value"
}
}
output{
stdout{
codec =>json_lines
}
}

My understanding is due to Cassandra it is unable to execute a select count(*) from (select * from ...) statement.

@brantkev
Copy link
Author

Anybody have something on this, still trying to resolve this issue.

@mikepedroza
Copy link

I ran into same thing. Seems that Cassandra doesn't have a COUNT query.
It happens when debug/trace level is set.
As a workaround, i changed /vendor/bundle/jruby/1.9/gems/logstash-input-jdbc-4.1.3/lib/logstash/plugin_mixins/jdbc.rb to not call the qyery.count method.

def execute_statement(statement, parameters)
...
before
@logger.debug? and @logger.debug("Executing JDBC query", :statement => statement, :parameters => parameters, :count => query.count)
after:
@logger.debug? and @logger.debug("Executing JDBC query", :statement => statement, :parameters => parameters)

Haven't got it all working yet.. still trudging through with the next error....
16:17:26.973 [[main]<jdbc] WARN logstash.inputs.jdbc - Exception when executing JDBC query {:exception=>#<Sequel::DatabaseError: Java::JavaLang::StringIndexOutOfBoundsException: >}

@giuseppedicarlo
Copy link

Hi,
I have the same error, has anyone solved?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants