Integrations & Setup
...
Data formats
Read data from CSV
introduction to csv what? csv (comma separated values) is a simple file format used to store tabular data, such as measurements or sensor readings each line in the file represents a row, and each value is separated by a delimiter (commonly a comma) why? compatibility with existing systems most data exporters, sensors, and logging tools support csv broad usage easy to read, process, and share across platforms and programming languages csv settings the measurement settings section configures how csv data is interpreted and mapped into measurements this includes defining how each column in the csv file is used, setting up filters for data inclusion, and specifying data quality indicators valuecolumn description column of the value in the csv file for this measurement required yes example 6 statusgood description all values that are mapped to status 'good' multiple statuses can be configured using semicolon separated values required no example "valid;correct" timestamplayout description the layout of the timestamp, defaults to the timestamplayout setting on the collector more info https //pkg go dev/time#layout\ https //pkg go dev/time#layout\\ required no tagsincsv description \ this allows to add tags to the measurement with the tag value coming from csv data the structure of this setting is similar as the filter setting the json key is the column index (as string) where the tag value is present, and the json value is the tag key (or tag name) under which the data should be stored upon the measurement required no example {"4" "description"} filterbyregularexpression description if true, values in filter will be treated as a regular expression if false, values in filter will be treated as a (list of) value to match default is false required no locale description the locale with which numbers should be parsed default is the value of the corresponding setting on the collector required no this table lists some examples of number formats and the locale with which they can be correctly parsed to a number the collector can process the output in these examples is always the same 1234 56 input locale 1 234 56 en gb 1,234 56 en us 1 234,56 de de 1 234,56 fr fr 1234,56 nl be read csv data use json settings filters can be configured via json filter description filter to parse only the rows that match the filter the filter is a json object where the key is the column index (as a string) and the value is an exact value to match to match against a set of exact values, separate them with a semicolon to use the value as a regular expression, set filterbyregularexpression to true backslashes in regulars expressions need to be escaped with another backslash use {} to leave empty required no details key csv column index as a string value names used for mapping, separated by semicolons if multiple example in the following example (with filterbyregularexpression set to false ), the filter will only parse rows where the value of the first column is example value and the value of the second column is match with this or also match with this { "0" "example value", "1" "match with this;also match with this" } in the following example (with filterbyregularexpression set to true ), the filter will only parse rows where the value of the first column contains example and the value of the second column is match with this or also match with this { "0" "example", "1" "^(match with this|also match with this)$" } examples example 1 given the following csv format, with files being provided by a data source located in `europe/brussels` time,name,value,unit,quality "1/12/2023 13 00 01 868",p99,"0 00",,good "1/12/2023 13 01 01 876",p99,"0 00",,good "1/12/2023 13 02 01 863",p99,"100 00",,good "1/12/2023 13 03 01 840",p99,"100 00",,good "1/12/2023 13 00 01 868",tt100,"27 51",,good "1/12/2023 13 01 01 876",tt100,"26 04",,good "1/12/2023 13 02 01 863",tt100,"25 97 00",,good "1/12/2023 13 03 01 840",tt100,"26 23",,good settings of the collector and the measurement would be configured as below collector settings setting value delimiter , csvheader true timestampcolumn 0 timestamplayout 2/01/2006 15 04 05 000 statuscolumn 4 trimstring no value advanced setting value sourcetimezone europe/brussels measurement settings setting value name area pump99 valuecolumn 2 filter { "1" "p99" } statusgood good tagsincsv {} timestamplayout no value setting value name area temperature100 valuecolumn 2 filter { "1" "tt100" } statusgood good tagsincsv {} timestamplayout no value troubleshooting incorrect value parsing check locale and number format timestamp errors check timestamplayout and confirm it is correct