How to use a wildcard in Google Cloud Ops Agent configuration file

706 Views Asked by At

I am using a custom configuration file for the Ops Agent to send logs from a specified path to Cloud Logging (GCP). When I am inserting the full path of a file (i.e. - C:/nginx-1.20.2/logs/access.log), I am able to successfully send the logs to Logging. However, when a wildcard (*) is used, the logs are not sent at all. I am following the official documentation utilizing the same syntax. The system I use is a Windows Server 2019 VM.

This is my .yaml file (using files as a type):

C:\Program Files\Google\Cloud Operations\Ops Agent\config\config.yaml

logging:
  receivers:
    nginx:
      type: files
      include_paths:
      - C:/nginx-1.20.2/logs/*.log
  processors:
    nginx:
      type: parse_json
      field: message
      time_key: time
      time_format: "%Y-%m-%d %H:%M:%S,%L"
  service:
    pipelines:
      nginx:
        receivers: [nginx]
        processors: [nginx]
      default_pipeline:
        receivers: []

I am doing something wrong or this a general issue? Does anyone have any idea?

1

There are 1 best solutions below

0
On

I found my issue. When you want to use a wild card in Windows, the path should have the following format: C:\nginx-1.20.2\logs\*.log instead of C:/nginx-1.20.2/logs/*.log. Probably this example clarifies the log collection paths.