Install and Configure Logging Agent on Google Cloud

Get Started
45 minutes
  • 3 Learning Objectives

About this Hands-on Lab

This lab guides you through installing the Cloud Logging agent on a Compute Engine instance, acting as an Apache web server. We install and configure the agent on the web server instance, and view application-specific logs collected.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Install and Configure Logging Agent on Website Instance
  1. Once on the Google Cloud Platform page, select Compute Engine >>VM Instances and click on the External IP and keep this tab open.

  2. In a new browser tab, we note the logs available by clicking on the top-left three bar-menu, and select Logging >> Log Explorer(open in new tab).

  3. Click VM Instance and note the logs under the Log Name portion.

  4. Connect to the Compute Engine, by going back to the Compute Engine browser tab. Select SSH to enter into the Compute Engine instance. This launches a new browser tab with access to a Cloud terminal.

  5. Once in the Compute Engine terminal, install the agent:

    curl -sSO https://dl.google.com/cloudagents/add-logging-agent-repo.sh
  6. Execute the script:

    sudo bash add-logging-agent-repo.sh
  7. Update our repo:

    sudo apt update
  8. Install the logging agent:

    sudo apt install google-fluentd
  9. Install additional configurations:

    sudo apt install -y google-fluentd-catch-all-config
  10. Restart the agent:

    sudo service google-fluentd restart
  11. Ensure the agent is running:

    sudo service google-fluentd status

    If running, this output will contain: Active: active (running).

  12. Exit out of the SSH terminal with:

    exit
Generate Traffic to Our Example Website
  1. Generate traffic/logs to our example website by navigating back to this Compute Engine’s browser tab. Refresh the page multiple times (5-10 times).
View Apache-Access and Linux Syslog Logs in Logs Viewer
  1. Navigate back to the Log Explorer browser tab and refresh this page.
  2. Click Options >> Go back to the Legacy Logs Viewer.
  3. Select Legacy Log Viewer. In the first dropdown menu (Audited Resources), select VM Instance >>web-agent-server.
  4. The All logs drop-down menu shows new log entries that are specific to our Compute Engine (apache-access, apache-error, syslog).

Additional Resources

How to Log in to Google Lab Accounts

  On the lab page, right-click Open Google Console and select the option to open it in a new private browser window (this option will read differently depending on your browser — e.g., in Chrome, it says "Open Link in Incognito Window"). Then, sign in to Google Cloud Platform using the credentials provided on the lab page.   On the Welcome to your new account screen, review the text, and click Accept. In the "Welcome Cloud Student!" pop-up once you're signed in, check to agree to the terms of service, choose your country of residence, and click Agree and Continue.

What are Hands-on Labs

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Get Started
Who’s going to be learning?

How many seats do you need?

  • $499 USD per seat per year
  • Billed Annually
  • Renews in 12 months

Ready to accelerate learning?

For over 25 licenses, a member of our sales team will walk you through a custom tailored solution for your business.


$2,495.00

Checkout
Sign In
Welcome Back!
Thanks for reaching out!

You’ll hear from us shortly. In the meantime, why not check out what our customers have to say about ACG?