【问题标题】:Monitoring Apache2 in Google Cloud with Ops Agent使用 Ops Agent 监控 Google Cloud 中的 Apache2
【发布时间】:2021-07-16 17:38:56
【问题描述】:

我在 Google Cloud Platform 的一个虚拟机中安装了 Apache2。我安装了Ops Agent 并将其配置如下per the docs

logging:
  receivers:
    mywebserver:
      type: files
      include_paths:
      - /var/log/apache*/access_log
      - /var/log/apache*/error_log
  service:
    pipelines:
      default_pipeline:
        receivers:
        - mywebserver

但是 GCP 中的日志没有显示此网络服务器的日志。即使对于此 VM 实例,我也没有在日志下拉列表中看到服务 mywebserver 作为过滤器选项。

操作系统:Ubuntu 18.x LTS

Ops Agent 版本:今天最新

我错过了什么?非常感谢您的帮助。

【问题讨论】:

  • 你通过troubleshooting docs了吗?一个简单的代理重启可能会成功....
  • 1) 您为虚拟机的访问范围设置了什么? 2) SSH 进入 VM 并在此处查看错误消息:/var/log/google-cloud-ops-agent/subagents/*.log
  • 还要检查附加到您的 VM 的服务帐户,如果您使用的是默认 SA,那么编辑器应该没问题。如果您使用自己的 SA,请确保选择编辑器或监控管理员。

标签: google-cloud-platform apache2 google-cloud-stackdriver google-cloud-logging google-cloud-ops-agent


【解决方案1】:

当我尝试使用命令cat /var/log/google-cloud-ops-agent/subagents/*.log | grep apache 进行调试时,它什么也没返回。它应该显示类似于下面的内容:

[ info] [input:tail:tail.0] inotify_fs_add(): inode=268631 watch_fd=1 name=/var/log/apache2/access.log
[input:tail:tail.0] inotify_fs_add(): inode=268633 watch_fd=2 name=/var/log/apache2/error.log

这促使我返回日志并意识到google docs 有一个错字,我最终善意地复制粘贴了这些行。基本上,如果您记下我的配置而不是access.log,则该行包含access_log

虽然听起来微不足道,但这却扼杀了我的大量时间。 :脸:

教训:即使是 Google Docs 也可能出现像这样微不足道的错误,可能会浪费你调试的时间。

【讨论】:

    猜你喜欢
    • 2022-09-23
    • 2020-05-23
    • 1970-01-01
    • 2023-04-10
    • 2016-10-13
    • 1970-01-01
    • 2023-04-05
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多