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

**URL:** <https://discuss.elastic.co/t/logstash-input-jdbc-hoto-use-the-actual-date-in-select-tablename/74032>\
**Category:** Logstash\
**Created:** [February 6, 2017, 9:22am UTC](https://discuss.elastic.co/t/logstash-input-jdbc-hoto-use-the-actual-date-in-select-tablename/74032 "2017-02-06T09:22:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![asterix](https://avatars.discourse-cdn.com/v4/letter/a/839c29/32.png) [@asterix](https://discuss.elastic.co/u/asterix)\
**Post date:** [February 6, 2017, 9:22am UTC](https://discuss.elastic.co/t/logstash-input-jdbc-hoto-use-the-actual-date-in-select-tablename/74032/1 "2017-02-06T09:22:23Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [March 6, 2017, 9:22am UTC](https://discuss.elastic.co/t/logstash-input-jdbc-hoto-use-the-actual-date-in-select-tablename/74032/2 "2017-03-06T09:22:34Z")

</div>

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