Hi,
When I perform the following tests with telegraf, the time is not formatted correctly “I don’t have milliseconds”.
Config input:
[inputs.file]]
files = ["/home/test3.csv"]
measurement = "test_data"
data_format = "csv"
csv_header_row_count = 1
csv_timestamp_column = "time"
csv_timestamp_format = "2006-01-02 15:04:05.000"
test3.csv
id_message,time,data1,data2,data3,data4,data5,data6,data7,id_slave
id_message,time,data1,data2,data3,data4,data5,data6,data7,id_slave
62837428,2022-08-24 16:15:05.110,54.169525,40.283817,16.632334,13.351644,13.580529,12.283512,5000,1
62837429,2022-08-24 16:15:05.210,54.47471,40.36011,16.556038,13.656824,13.580529,12.207217,5000,1
62837430,2022-08-24 16:15:05.310,54.245823,40.36011,16.556038,13.656824,13.580529,11.902037,5000,1
62837431,2022-08-24 16:15:05.410,54.322117,40.05493,16.632334,13.733119,13.656824,11.978332,5000,1
62837432,2022-08-24 16:15:05.510,54.47471,40.283817,16.479742,13.656824,13.656824,11.902037,5000,1
62837433,2022-08-24 16:15:05.610,54.322117,40.436405,16.403448,13.504234,13.351644,11.825742,5000,1
62837434,2022-08-24 16:15:05.710,54.322117,40.588997,16.403448,13.656824,13.733119,11.902037,5000,1
62837435,2022-08-24 16:15:05.810,53.864346,40.05493,16.556038,13.580529,13.733119,11.825742,5000,1
62837436,2022-08-24 16:15:05.910,54.169525,40.283817,16.632334,13.351644,13.580529,12.283512,5000,1
62837437,2022-08-24 16:15:06.010,54.47471,40.36011,16.556038,13.656824,13.580529,12.207217,5000,1
62837438,2022-08-24 16:15:06.110,54.245823,40.36011,16.556038,13.656824,13.580529,11.902037,5000,1
62837439,2022-08-24 16:15:06.210,54.322117,40.05493,16.632334,13.733119,13.656824,11.978332,5000,1
62837440,2022-08-24 16:15:06.310,54.47471,40.283817,16.479742,13.656824,13.656824,11.902037,5000,1
62837441,2022-08-24 16:15:06.410,54.322117,40.436405,16.403448,13.504234,13.351644,11.825742,5000,1
62837442,2022-08-24 16:15:06.510,54.322117,40.588997,16.403448,13.656824,13.733119,11.902037,5000,1
62837443,2022-08-24 16:15:06.610,53.864346,40.05493,16.556038,13.580529,13.733119,11.825742,5000,1
62837444,2022-08-24 16:15:06.710,54.47471,40.36011,16.556038,13.656824,13.580529,12.207217,5000,1
62837445,2022-08-24 16:15:06.810,54.245823,40.36011,16.556038,13.656824,13.580529,11.902037,5000,1
62837446,2022-08-24 16:15:06.910,54.322117,40.05493,16.632334,13.733119,13.656824,11.978332,5000,1
62837447,2022-08-24 16:15:07.010,54.47471,40.36011,16.556038,13.656824,13.580529,12.207217,5000,1
62837448,2022-08-24 16:15:07.110,54.245823,40.36011,16.556038,13.656824,13.580529,11.902037,5000,1
62837449,2022-08-24 16:15:07.210,54.322117,40.05493,16.632334,13.733119,13.656824,11.978332,5000,1
62837450,2022-08-24 16:15:07.310,54.47471,40.283817,16.479742,13.656824,13.656824,11.902037,5000,1
62837451,2022-08-24 16:15:07.410,54.322117,40.436405,16.403448,13.504234,13.351644,11.825742,5000,1
62837452,2022-08-24 16:15:07.510,54.322117,40.588997,16.403448,13.656824,13.733119,11.902037,5000,1
62837453,2022-08-24 16:15:07.610,53.864346,40.05493,16.556038,13.580529,13.733119,11.825742,5000,1
62837454,2022-08-24 16:15:07.710,54.47471,40.36011,16.556038,13.656824,13.580529,12.207217,5000,1
62837455,2022-08-24 16:15:07.810,54.245823,40.36011,16.556038,13.656824,13.580529,11.902037,5000,1
62837456,2022-08-24 16:15:07.910,54.322117,40.05493,16.632334,13.733119,13.656824,11.978332,5000,1
Select in InfluxDB for data1
> select "data1","data2","data3","data4","data5","data6","data7" from file
name: file
time data1 data2 data3 data4 data5 data6 data7
---- ----- ----- ----- ----- ----- ----- -----
1661357705000000000 54.322117 40.05493 16.632334 13.733119 13.656824 11.978332 5000
1661357706000000000 54.322117 40.436405 16.403448 13.504234 13.351644 11.825742 5000
1661357707000000000 54.322117 40.436405 16.403448 13.504234 13.351644 11.825742 5000
1661357708000000000 54.322117 40.05493 16.632334 13.733119 13.656824 11.978332 5000
I have checked the time formatting:
package main
import (
"fmt"
"time"
)
func main() {
t, e := time.Parse(`2006-01-02 15:04:05.000`, `2022-08-24 16:15:05.110`)
if e != nil {
panic(e)
}
fmt.Println(t.UTC().UnixNano() / 1000000)
}
Output fuction GO:
1661357705110
Program exited.
As you can see in the test it inserts me well, the problem I have is that it only detects me in seconds and not in milliseconds.
Could you help me with the problem or if I have to look for another time base?
redgards