# Support for dynamic values in table\_prefix and date\_pattern in the BigQuery Logstash output plugin

**URL:** <https://discuss.elastic.co/t/support-for-dynamic-values-in-table-prefix-and-date-pattern-in-the-bigquery-logstash-output-plugin/362885>\
**Category:** Logstash\
**Created:** [July 10, 2024, 1:26pm UTC](https://discuss.elastic.co/t/support-for-dynamic-values-in-table-prefix-and-date-pattern-in-the-bigquery-logstash-output-plugin/362885 "2024-07-10T13:26:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Deena\_Dayalan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/deena_dayalan/32/135951_2.png) [@Deena\_Dayalan](https://discuss.elastic.co/u/Deena_Dayalan)\
**Post date:** [July 10, 2024, 1:26pm UTC](https://discuss.elastic.co/t/support-for-dynamic-values-in-table-prefix-and-date-pattern-in-the-bigquery-logstash-output-plugin/362885/1 "2024-07-10T13:26:11Z")

</div>

Im using kafka and BigQuery as input and output plugins. Events coming from kafka are stored in BigQuery. But I want to attach the table\_prefix with some field in the events.  
For example, if the event contains "userId": "12345", then the table prefix I want will be  
**table\_prefix =\> "logs\_%{userId}"**  
but the table creates with the literal string like logs\_%{userId}\_date.  
Similar for the date\_pattern. when i try to create a table with the event timestamp date, im not able to create it. the table creates with literal string  
for example,

**date\_pattern =\> "%{date}"**

Here the date is "20240708", but the table creates like this logs\_%{date}

How to handle this in Logstash? Is there any way to create the dynamic table name from the event field names?

For reference: [Google BigQuery output plugin | Logstash Reference [8.14] | Elastic](https://www.elastic.co/guide/en/logstash/current/plugins-outputs-google_bigquery.html#plugins-outputs-google_bigquery-date_pattern)

#Logstash #bigqueryplugin

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [July 10, 2024, 2:04pm UTC](https://discuss.elastic.co/t/support-for-dynamic-values-in-table-prefix-and-date-pattern-in-the-bigquery-logstash-output-plugin/362885/2 "2024-07-10T14:04:04Z")

</div>

> [@Deena\_Dayalan](#):
>
> Is there any way to create the dynamic table name from the event field names?

I do not think so, the [code](https://github.com/logstash-plugins/logstash-output-google_bigquery/blob/c29ff8df877fac02ac61282de8fb6d9eaab5e112/lib/logstash/outputs/google_bigquery.rb#L208) just concatentes the three parts of the table id. An [issue](https://github.com/logstash-plugins/logstash-output-google_bigquery/issues/56) was opened four years ago requesting that the output sprintf these options.

---

<div class="post-metadata">

**Author:** ![Deena\_Dayalan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/deena_dayalan/32/135951_2.png) [@Deena\_Dayalan](https://discuss.elastic.co/u/Deena_Dayalan)\
**Post date:** [July 10, 2024, 2:26pm UTC](https://discuss.elastic.co/t/support-for-dynamic-values-in-table-prefix-and-date-pattern-in-the-bigquery-logstash-output-plugin/362885/3 "2024-07-10T14:26:55Z")

</div>

Thanks for the reply @Badger . Is there any alternative way to achieve this using Logstash ?
