How to use current date to determine table name for jdbc_input query?

I have a database with a table per month for data:

table_01, table_02, ..., table_12

Is it possible to have logstash construct the table name at runtime, and use it in the query?

You can pass parameters to the statement using the parameters option. You might be able to set one of the parameters using an environment variable.

It's invalid sql to use a parameter for the table name, and the date replacement doesn't get performed for the parameter value anyway.

The only other thing I can think of is to use statement_filepath instead of statement and deal with it outside of logstash.

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