Use Case
I need to write multiple timestamp columns (e.g., created_at, updated_at, event_time)
to a PostgreSQL table with timestamptz type. Currently, Telegraf fields only support
string, float64, int64, uint64, and bool. There is no way to pass a native
time.Time value through the metric pipeline so that outputs like outputs.postgresql
can create timestamp with time zone columns for data fields (not just the metric's
time column).
Expected behavior
Allow time.Time as a valid field value type in telegraf.Metric, and have
outputs.postgresql (and potentially other SQL outputs) map it to timestamptz
or timestamp column types.
Actual behavior
Fields with timestamp data must be stored as strings or integers, which requires:
- Either pre-processing outside Telegraf to convert before insertion
- Or maintaining a custom fork with a processor plugin that converts string/numeric
fields to time.Time and patching the metric core + postgresql output
Additional info
This is distinct from the existing timestamp_column_name option in outputs.postgresql,
which only controls the type of the metric's time column. The need here is for
arbitrary fields to carry timestamp values.
Use Case
I need to write multiple timestamp columns (e.g.,
created_at,updated_at,event_time)to a PostgreSQL table with
timestamptztype. Currently, Telegraf fields only supportstring,float64,int64,uint64, andbool. There is no way to pass a nativetime.Timevalue through the metric pipeline so that outputs likeoutputs.postgresqlcan create
timestamp with time zonecolumns for data fields (not just the metric'stimecolumn).Expected behavior
Allow
time.Timeas a valid field value type intelegraf.Metric, and haveoutputs.postgresql(and potentially other SQL outputs) map it totimestamptzor
timestampcolumn types.Actual behavior
Fields with timestamp data must be stored as strings or integers, which requires:
fields to
time.Timeand patching the metric core + postgresql outputAdditional info
This is distinct from the existing
timestamp_column_nameoption inoutputs.postgresql,which only controls the type of the metric's
timecolumn. The need here is forarbitrary fields to carry timestamp values.