0

How to Configure the CSV Collector (version 22)

There are two files that need created/configured upon installing the CSV Collector:

  • SAF_ImportService.config
  • SAF_Import.config

SAF_ImportService.config

By default, the service config file is located in C:\Program Files\Canary\Collectors\CSV. Below is an example of how it is configured where

  • Interval = (seconds) how often the service checks the input directory for new CSV files to process
  • InputDirectory = the filepath of the directory the service will monitor for CSV files. (*Multiple input directories can be listed.)
<Settings>
    <Interval>10</Interval>
    <InputDirectory>C:\CSV Import</InputDirectory>
</Settings>

SAF_Import.config

The 'SAF_Import.config' will need to be created and must reside in every directory specified in the InputDirectory parameter from above. This config tells the service how to interpret the CSV files that will be placed in the directory to be processed. As CSV files can vary with different formats, there are over 30 parameters to choose from to match the file's particular structure. (See Canary CSV Collector Configuration.pdf above for these parameters.) Once a file is dropped into the specified directory, the service will attempt to read and log the data into the historian.

<Settings>
    <InputDelimiter>,</InputDelimiter>
    <HeaderCount>0</HeaderCount>
    <Historian>localhost</Historian>
    <DataSet>Demo</DataSet>
    <TagNameOffset>0</TagNameOffset>
    <TimestampOffset>1</TimestampOffset>
    <ValueOffset>2</ValueOffset>
    <QualityOffset>3</QualityOffset>
    <KeepProcessedFiles>True</KeepProcessedFiles>
    <ProcessedDirectory>C:\CSV Import\Processed</ProcessedDirectory>
    <AutoCreateDataSet>True</AutoCreateDataSet>
    <AllowInsertedData>True</AllowInsertedData>
</Settings>

 

If any modifications are made to either one of these files, the service will need restarted to pick up the changes.

4 replies

null
    • ggrebennik
    • 2 yrs ago
    • Reported - view

    According to documentation csv files will be either discarded or moved to processed folder. Does it mean csv collector cannot read files incrementally without moving or deleting file?

      • smason
      • 2 yrs ago
      • Reported - view

      Hi ggrebennik !

      The CSV Collector is expecting a "static" file. After it reads the file, it then discards it, or moves it to another directory. If the file is constantly being written to, it will not be able to process it, as it is open.

    • mattias_herrfurth
    • 2 yrs ago
    • Reported - view

    Could we get examples of inputs for the TimeFormat parameter?

      • smason
      • 2 yrs ago
      • Reported - view

      mattias. herrfurth 

      We use .NET's formatting https://docs.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings

      So, if the collector does not recognize the time format or is not interpreting it the way you expect, you can use that parameter to indicate what it should be. For example,

      <TimeFormat>h:m:ss</TimeFormat>

      • uses a 12-hour clock from 1 to 12
      • minutes ranging from 0 to 59
      • seconds ranging from 00 to 59