-
Notifications
You must be signed in to change notification settings - Fork 5.8k
csv_skip_rows>0 and csv_header_row_count>=1 results in error while reading file #9898
Copy link
Copy link
Closed
Labels
bugunexpected problem or unintended behaviorunexpected problem or unintended behavior
Description
When using inputs.directory_monitor with the CSV data format. CSV files that start with metadata or have multi-row headers would result in an error while reading the file.
Relevant telegraf.conf:
[[inputs.directory_monitor]]
directory = "/path/to/unprocessed"
finished_directory = "/path/to/processed"
error_directory = "/path/to/error"
files_to_monitor = ["^.*\.csv"]
file_tag = "filename"
data_format = "csv"
csv_header_row_count = 1
csv_column_names = []
csv_column_types = []
csv_skip_rows = 2
csv_skip_columns = 0
csv_delimiter = ","
csv_comment = ""
csv_trim_space = false
csv_tag_columns = []
csv_measurement_column = ""
csv_timestamp_column = ""
csv_timestamp_format = ""
csv_timezone = ""
csv_skip_values = []System info:
Telegraf 1.20.0
Steps to reproduce:
- Create a
metrics.csvfile with the following information in the/path/to/folder.
version=1.0
file created: 2021-10-08T12:34:18+10:00
timestamp,type,name,status
2020-11-23T08:19:27+10:00,Reader,R002,1
2020-11-04T13:23:04+10:00,Reader,R031,0
2020-11-04T13:29:47+10:00,Coordinator,C001,1
Expected behaviour:
The expected behaviour would be that the parser would skip the first two lines and parse the rest of the file as normal.
Actual behaviour:
The first two metadata lines are not ignored and it results in an error while reading the file.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugunexpected problem or unintended behaviorunexpected problem or unintended behavior