[英]How to use a wildcard in Google Cloud Ops Agent configuration file
我正在使用 Ops Agent 的自定義配置文件將日志從指定路徑發送到 Cloud Logging (GCP)。 當我插入文件的完整路徑(即 - C:/nginx-1.20.2/logs/access.log )時,我能夠成功地將日志發送到 Logging。 但是,當使用通配符 (*)時,根本不會發送日志。 我遵循使用相同語法的官方文檔。 我使用的系統是Windows Server 2019 VM。
這是 my.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: []
我做錯了什么或者這是一個普遍問題? 有人有什么主意嗎?
我發現了我的問題。 當你想在 Windows 中使用通配符時,路徑應該具有以下格式: C:\nginx-1.20.2\logs\*.log而不是 C:/nginx-1.20.2/logs/*.log。 可能這個例子闡明了日志收集路徑。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.