Search code examples
regexdatadogfnmatch

DataDog Directory file matching pattern fails to match any files


The directory contains more than 20 files. As explained in the DataDog directory documentation, a maximum of 20 files can be tracked.

So I tried to configure the data dog directory configuration

init_config:

instances:
  - directory: /mnt/ftp/generic/SalesorderPosition
    pattern: '20([0-9][0-9]_12_+.*).csv'
    filegauges: true

Files are in the next format yyyy_mm_SalesorderPosition.csv and I need to show the latest month in all previus years.

When the pattern is enabled in the config, no files are matched. When I remove it files are counted.

What did I miss here?


Solution

  • Read the doc you linked. The pattern is a fnmatch pattern, not Regex.

    https://docs.python.org/3/library/fnmatch.html

    UPDATE:

    The exact working solution would be

    init_config:
    
    instances:
      - directory: /mnt/ftp/generic/SalesorderPosition
        pattern: '*_12_SalesorderPosition.csv'
        filegauges: true