fluent-plugin-bigquery:占位符子字符串
fluent-plugin-bigquery: placeholder substring
我有一个 JSON 像这样的流利输入。
{ "dateTime": "YYYY-mm-dd HH:MM:SS" }
我想将此消息存储到 Google BigQuery table table_YYYYmmdd
.
我知道我可以像这样编写配置
<match tag>
@type bigquery
table table_%Y%m%d
:
</match>
但是 JSON 消息中的日期 不是 今天。我想按照JSON消息中的日期存储记录。
我该怎么做?
自己解决了。
<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>
我有一个 JSON 像这样的流利输入。
{ "dateTime": "YYYY-mm-dd HH:MM:SS" }
我想将此消息存储到 Google BigQuery table table_YYYYmmdd
.
我知道我可以像这样编写配置
<match tag>
@type bigquery
table table_%Y%m%d
:
</match>
但是 JSON 消息中的日期 不是 今天。我想按照JSON消息中的日期存储记录。
我该怎么做?
自己解决了。
<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>