Logstash-input-jdbc: hoto use the actual date in select-tablename


(Juergen) #1

Hello there,

I'm new to elasticsearch an logstahs. And I've got a little problem. Perhaps someone can help me:
I want to read mysql-tables with logstash. This will work fine. But, because there are talles of the log of our application, the tablename will change every day.
FDor exlample:
log_20170101
log_20170102
log20170104
and so on ...

I've tried this with this configuration:

input {
jdbc {
jdbc_connection_string => "jdbc:mysql://###.###.###.####:3306/log"
jdbc_user =>######
jdbc_password => #######
jdbc_driver_library =>"c:\logstash-5.2.0\mysql-connector-java-5.1.40\mysql-connector-java-5.1.40-bin.jar"
jdbc_driver_class => "com.mysql.jdbc.Driver"
parameters =>{table => log_20170202}
statement => "Select * from :table"
}

  }

But it won't work. This will genrate this statement: select * from 'log_20170202' .
But it should be select * from log_2017020
How can I avoid the ' ?
And how can I get the date from the system?

Thanks alot!
Bestregards
Asterix


(system) #2

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