I have created the Starlark script below which functions as expected, however the two output metrics “higham_spd” and “higham_dir” inherit the same type (in this case string) as the input metric “higham_message”.
I would like to change the type of the output metrics to int, however if I do so within the python script, the following error message is generated within telegraf:
2023-09-12T08:50:47Z E! [outputs.influxdb_v2] Failed to write metric (will be dropped: 400 Bad Request): invalid: dml handler error: schema conflict: table higham_anemometer, column higham_spd is type string but write has type i64
I was hoping there is another way to change the output metric type.
@simonsmart9 not exactly sure, but I read the error message the opposite way, you are trying to write an int64 but the column in InfluxDB is of type string…
Thank you @srebhan. I was looking at the split processor yesterday but couldn’t figure out how to use it to accomplish what I have done with Starlark. Any pointers would be much appreciated.
Regarding the int type, it was a school boy error. I forgot to change the measurement name, so influxdb was refusing an int in the field which had already been specified as a string. With the change it looks as follows:
Sorry, seems like you can’t do it with the split processor. I was misreading your message.
You could use the parser processor with CSV but I’m not sure it’s worth it if you are fine with the performance of starlark…