Telegraf different measurements input from csv howto

I’m having problems with CSV input to influxdb using telegraf plugins. Seems that file plugin uses csv_header_row_count only from the first file read. But i have multiple csv files with different sets of metrics.
Telegraf when started reads header row from the first file of “files = [”/data/siem/input/*.csv"]" and uses it for the next file which has its own different header row.
Is there a way to change this behavior ?

Fixed that in source. Just removed the check if columns are already named. 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()
> > //            }
> > //    }

This is a bug, would you be able to open a new issue on the Telegraf GitHub page?

Yup, did that

1 Like