0
私はfluentdを使用してセンサーのセットからデータをプッシュしています。私がプッシュしているデータには、日付コンポーネント(年、月など)で爆発する必要のある「タイムスタンプ」フィールド(ミリ秒単位)が含まれています。データがプッシュされたときにフィルタを使用しているので、いくつかのルビコードでタイムスタンプを簡単に爆発させることができます。Fluentdはフィルターの新しいフィールドに型を割り当てます
<filter *>
@type record_transformer
enable_ruby
<record>
year ${Time.at(Integer(record['timestamp'])/1000.0).strftime("%Y")}
monthnumber ${Time.at(Integer(record['timestamp'])/1000.0).strftime("%-m")}
monthname ${Time.at(Integer(record['timestamp'])/1000.0).strftime("%B")}
daynumber ${Time.at(Integer(record['timestamp'])/1000.0).strftime("%-d")}
dayname ${Time.at(Integer(record['timestamp'])/1000.0).strftime("%A")}
hour ${Time.at(Integer(record['timestamp'])/1000.0).strftime("%-k")}
minutes ${Time.at(Integer(record['timestamp'])/1000.0).strftime("%-M")}
seconds ${Time.at(Integer(record['timestamp'])/1000.0).strftime("%-S")}
</record>
</filter>
私の問題は私のいくつかのために厳密に(例えば、年のため、monthnumber、daynumber、など)の整数を必要としながら、それはつもりJSONに組み込むされ、新たなフィールドが、文字列型に割り当てられていることです。これらのフィールドを整数として追加する必要があることをfluentdに伝える方法はありますか?
私が試した:
year ${Integer(Time.at(Integer(record['timestamp'])/1000.0).strftime("%Y"))}
が、それはうまくいきませんでした。