How to get time stamp for the date and time which is already in my data?

2k views Asked by At

I am reading the data from kinesis and inserting it into the Telegraf. Data is coming in Telegraf and this data going in Influxb. The timestamp is being added automatically. I already have date and time column in my data. I want to insert the timestamp based on my date and time which is present in my data. I tried adding based on my date and time but it’s not happening. Its always adding the current timestamp.

Below is the configuration I am using.

[[outputs.influxdb]]
    urls = [“influxdb:8086”]
    #urls = [“http://localhost:8086”]
    database = “telegraf”


[[inputs.file]]
data_format = "csv"
csv_header_row_count = 1
csv_tag_columns = ["ver","node"]
csv_timestamp_column = ["date","time"]// want to add this as my timestamp
csv_timestamp_format = "2006-01-02T15:04:05"

Kinesis consumer configuration in telegraf.conf file

[[inputs.kinesis_consumer]]
    region = "provided"
    access_key ="provided"
    secret_key = "provided"
    profile = "provided"
     streamname = "telegraf_stream4"
    shard_iterator_type = "TRIM_HORIZON"
    name_override = "OM_file"
    data_format = "csv"
    csv_header_row_count = 1
    csv_tag_columns = ["ver","node"]
    csv_timestamp_column = ["date","time"]
    csv_timestamp_format = "2006-01-02T15:04:05"

The format of date and time in my table: Date - 2020/08/17 Time - 11:15:04

So, is there any way by which I can use my own date and time which is stored in my table for inserting the timestamp in Influxdb?

1

There are 1 answers

4
robert On BEST ANSWER

In telegraf configuration when you mention csv data format, csv_timestamp_column is a string field.

This means the timestamp should be present in a single column. You have mentioned it as an array.

csv_timestamp_column = ["date","time"]

The above configuration is not correct. You can mention only one column of the csv file as timetamp column. Following is a valid configuration.

csv_timestamp_column = "date"