如何在 Google Cloud Ops Agent 配置文件中使用通配符

发布于 2025-01-12 05:07:11 字数 933 浏览 1 评论 0原文

我正在使用 Ops Agent 的自定义配置文件将日志从指定路径发送到 Cloud Logging (GCP)。当我插入文件的完整路径(即 - C:/nginx-1.20.2/logs/access.log)时,我能够成功将日志发送到日志记录。但是,当使用通配符 (*) 时,根本不会发送日志。我正在遵循官方文档使用相同的语法。我使用的系统是 Windows Server 2019 虚拟机。

这是我的 .yaml 文件(使用 files 作为类型):

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 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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

烟织青萝梦 2025-01-19 05:07:11

我发现了我的问题。当您想在 Windows 中使用通配符时,路径应采用以下格式:C:\nginx-1.20.2\logs\*.log 而不是 C:/nginx-1.20.2 /logs/*.log。可能这个示例澄清了日志收集路径。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文