Buy @ Amazon

Configuring Google Ops Agent for Monitoring Apache 2 Web Server in Ubuntu VM

Google Cloud released Ops Agent as GA in Jan 2021. The Ops Agent collects logs and metrics on Compute Engine instances, sending your logs to Cloud Logging and your metrics to Cloud Monitoring.

I performed the following steps to get this working in the Ubuntu VM in my Google Cloud account.

Step 1 : Install the latest version of the agent per the docs

Step 2 : Create and edit `/etc/google-cloud-ops-agent/config.yaml` which is a user-specified configuration that will over-ride built-in configuration for same keys and merge with built-in configuration for different keys. This config file should have the content below:

Step 3 : Restart the agent for the custom configuration to above to take effect. You can restart the agent by executing `sudo service google-cloud-ops-agent restart` in your bash terminal. You can list the available versions of the agent with `sudo apt-cache madison google-cloud-ops-agent`.

Step 4 : To ensure that the agent is ingesting the custom log path, (in our case apache's logs), exec `cat /var/log/google-cloud-ops-agent/subagents/*.log | grep apache` in your bash terminal to see if it shows any output.