Skip to content

input.file plugin behavior with different input metrics files #6318

@vtsick

Description

@vtsick

Relevant telegraf.conf:

[[inputs.file]]
  files = ["/data/siem/input/*.csv"]
  data_format = "csv"
  csv_header_row_count = 1

System info:

Steps to reproduce:

  1. use two or more csv files for input but set different headers rows there

Expected behavior:

Read header row from every file in the input list and use it for ongoing metrics.

Actual behavior:

Telegraf when started reads header row only from the first file of “files = [”/data/siem/input/*.csv"]" and uses it for the next file which has its own different header row.

Additional info:

I just removed the column names check from the source. But ideally this should be configurable behavior.
Below are diffs for
~/go/src/github.com/influxdata/telegraf/plugins/parsers/csv/parser.go

> 64c64
-       if len(p.ColumnNames) == 0 {
> ---
+ //    if len(p.ColumnNames) == 0 {
> 84,89c84,89
-       } else {
-               // if columns are named, just skip header rows
-               for i := 0; i < p.HeaderRowCount; i++ {
-                       csvReader.Read()
-               }
-       }
> ---
+ //    } else {
+ //            // if columns are named, just skip header rows
+ //            for i := 0; i < p.HeaderRowCount; i++ {
+ //                    csvReader.Read()
+ //            }
+ //    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugunexpected problem or unintended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions