Your team manages several Ubuntu 20.04 Compute Engine VMs that run a custom web application. You must start collecting both system metrics and the application's log files located in /var/log/webapp/*.log and send them to Cloud Monitoring and Cloud Logging. Company policy permits only a single observability agent on any VM, and you want to minimize manual effort during rollout. Which approach meets the requirements?
Enable only the Cloud Monitoring API and use guest attributes plus a log sink to ingest the application's log files without any agent.
Run the Google-provided installation script to deploy the Ops Agent, then add a logs.files entry for /var/log/webapp/*.log in /etc/google-cloud-ops-agent/config.yaml and restart the agent.
Install the legacy Stackdriver Monitoring and Logging agents separately and configure fluentd to monitor the application logs.
Use OS Login to launch the Ops Agent in a Docker container and rely on its automatic log discovery, requiring no configuration changes.
The Ops Agent is Google Cloud's single, combined agent for collecting both system metrics and logs. On Ubuntu 20.04 you can install it quickly by downloading and running the add-google-cloud-ops-agent-repo.sh helper script, which adds the Google repository and installs the agent in one short sequence. After installation, create or edit /etc/google-cloud-ops-agent/config.yaml to add a logs.files section that points to /var/log/webapp/*.log, then restart the agent so it begins forwarding those logs along with default system metrics.
Using the two separate legacy agents would violate the one-agent policy. Guest attributes and log sinks cannot ship local log files without an agent. Running the Ops Agent inside a Docker container is not supported, and the agent will not pick up arbitrary application logs unless they are explicitly defined in its configuration.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What is the Ops Agent in Google Cloud?
Open an interactive chat with Bash
How do you configure the Ops Agent to collect custom application logs?
Open an interactive chat with Bash
Why is using the legacy Stackdriver agents not recommended?
Open an interactive chat with Bash
What is the Ops Agent in Google Cloud?
Open an interactive chat with Bash
Why is it necessary to edit the config.yaml file for Ops Agent?
Open an interactive chat with Bash
How does the Ops Agent differ from legacy Stackdriver agents?
Open an interactive chat with Bash
GCP Associate Cloud Engineer
Ensuring successful operation of a cloud solution
Your Score:
Report Issue
Bash, the Crucial Exams Chat Bot
AI Bot
Loading...
Loading...
Loading...
Pass with Confidence.
IT & Cybersecurity Package
You have hit the limits of our free tier, become a Premium Member today for unlimited access.
Military, Healthcare worker, Gov. employee or Teacher? See if you qualify for a Community Discount.
Monthly
$19.99
$19.99/mo
Billed monthly, Cancel any time.
3 Month Pass
$44.99
$14.99/mo
One time purchase of $44.99, Does not auto-renew.
MOST POPULAR
Annual Pass
$119.99
$9.99/mo
One time purchase of $119.99, Does not auto-renew.
BEST DEAL
Lifetime Pass
$189.99
One time purchase, Good for life.
What You Get
All IT & Cybersecurity Package plans include the following perks and exams .