Does Telegraf can insert to Postgre on jsonb format?

Hi,

I’m trying to insert data to Postgre with Telegraf in jsonb format.
I know that I can use fields_as_jsonb = true but with this all my fields will be inserted in jsonb. I want to insert only some specific fields in jsonb.
Has Telegraf this capability ?

Thank you

Hi!

I don´t know if this is an elegant solution, bus since some fields must be in a format and other don´t, what about setup two output plugins to postgree and use “tagexclude” or “fieldexclude” parameter on each plugin, to send only the desired information on each format?

Hope it helps

Hi,

I was not aware of this feature. I tested with 2 output plugins using namepass and namedrop and it is working fine. I use the option “fields_as_jsonb = true” only for one of my 2 output plugins. It is not very flexible. I think an improvement to postgre output plugin could be to be able to choose the type of fields for each field, not only for all fields or none.

Thank you for your help

1 Like