如何在 Google Cloud Ops Agent 配置文件中使用通配符
我正在使用 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我发现了我的问题。当您想在 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.