fluent-plugin-bigquery:占位符子字符串

时间:2017-03-09 11:27:31

标签: fluentd

我有一个像这样流利的JSON输入。

{ "dateTime": "YYYY-mm-dd HH:MM:SS" }

我想将此邮件存储到Google BigQuery表table_YYYYmmdd

我知道我可以编写像

这样的配置
<match tag>
  @type bigquery
  table table_%Y%m%d
     :
</match>

但今天JSON消息中的日期。我想根据JSON消息中的日期存储记录。

我该怎么做?

1 个答案:

答案 0 :(得分:0)

自我解决。

<filter tag>
  @type record_transformer
  enable_ruby true
  <record>
    yyyymmdd ${record["dateTime"][0..9].gsub("-", "")}
  </record>
</filter>

<match tag>
  @type bigquery
  ignore_unknown_values true
  table table_${yyyymmdd}
     :
</match>
相关问题