Ved
March 3, 2022, 6:08am
1
Hi,
I am a newbie using telegraf to write some custom data to influx DB. My application writes logs in this format every 15 minutes:
i-name;m-time;i-flag;time-stamp;violations;uncorrected-data;retransmitted-data;error-free-bits;minimum-error-free
P-1;900;false;2022-03-03 04:45:00;0;0;0;107434;5795
P-2;900;false;2022-03-03 04:45:00;0;0;0;104367;5638
P-3;900;false;2022-03-03 04:45:00;0;0;0;107314;5795
P-4;900;false;2022-03-03 04:45:00;0;0;0;103203;5569
I tried using CSV data format and tail input plugin, but I observed that, only last line is getting into influxdb. How can I make telegraf to process all 4 lines?
Or is there any other plugin that can help me ?
Thanks
Please show us your tail input plugin config snippet.
Ved
March 3, 2022, 11:56am
3
Thank you for your response. Here is the config snippet
cat telegraf.conf
[agent]
omit_hostname = true
interval = '15m'
[[inputs.tail]]
files = ["/log/logFile.csv"]
watch_method = "inotify"
pipe = false
data_format = "csv"
csv_header_row_count = 1
csv_delimiter = ";"
csv_timestamp_column = "time-stamp"
csv_timestamp_format = "2006-01-02 15:04:05"
from_beginning = false
[[outputs.influxdb_v2]]
urls = ["http://localhost:8086"]
token = "$INFLUX_TOKEN"
organization = "test"
Any problem in this?
Ved:
Any problem in this?
Yes, I think that the csv rows that have the same timestamp will be overwritten in influxdb since they have the same set of fields and no tags. I would add a tag to make the metrics unique:
csv_tag_columns = ["i-name"]
Ved
March 4, 2022, 12:40am
5
@Franky1 Yes, that helped. Now able to see all records. Thank you so much.
Many thanks for formatting my comments to make it look better.