Installing the Cloud Logging agent on individual VMs
Stay organized with collections
Save and categorize content based on your preferences.
The Logging agent streams logs from your VM instances and from
selected third-party software packages to Cloud Logging. It is a best
practice to run the Logging agent on all your VM instances.
The VM images for Compute Engine don't include the Logging agent,
so you must complete these steps to install it on those instances. The agent
runs under both Linux and Windows.
If your VMs are running in Google Kubernetes Engine or App Engine, the
agent is already included in the VM image, so you can skip this page.
Before you begin
To install the agent, ensure that you have the following:
Credentials on the VM instance that authorize communication with
Cloud Logging or Cloud Monitoring. Compute Engine VM instances
generally have the correct credentials by default. If the following
scenario applies to you, then you might not have the proper credentials and
must complete the
Authorize the Logging agent procedures:
Running very old Compute Engine instances or Compute Engine
instances created without the default credentials.
If you're using VMs that don't have access to remote package repositories,
refer to the VMs without remote package access
section for more information.
Install the agent from the command line
To install the agent using the command line, use the following instructions.
Install the latest version of the agent
To install the latest version of the agent, complete the following steps.
Linux
Open a terminal connection to your VM instance using SSH or a similar tool
and ensure you have sudo access.
Change to a directory you have write access to, for example your home
directory.
Download and run the agent-installation script by using the following
commands:
For production environments, you might want to pin to a major version to
avoid installing major versions that might include backward incompatible
changes. To pin to a major version, run:
If you use the search bar to find this page, then select the result whose subheading is
Monitoring.
The List view on the Inventory tab on the dashboard lists all VMs and
includes a status column for your agent, as shown in the following screenshot:
The Agent column reports the following values:
Not detected: Either you don't have an agent installed or it is
not running. If you aren't sure if you've installed an agent, then you
can query for the installed version. If you've installed
the agent, then you can restart the agent.
Ops Agent: You are running the Ops Agent.
If you don't see a green checkmark beside the entry, then there is an
agent upgrade available, based on the detected operating system of your VM.
When you hover over the Ops Agent indicator in the table, you see information
about the version of the Ops Agent. If you are running an older version, you
also see a recommendation to upgrade your agent.
Pending: The Ops Agent is being installed or upgraded.
Agent installation failed: Installation of the Ops Agent failed.
Not Collecting Telemetry: Installation of the Ops Agent succeeded, but
the agent isn't yet sending telemetry.
Not applicable: This VM is not a supported platform for running the agent.
VM Stopped: The VM is not running, so the agent's status is not known.
You can install the Ops Agent by doing the following:
Select the VM instances on which you want to install agents.
Click the Install/Update Ops Agent option on the Instances table.
You can also install or update the Ops Agent from
the VM Details page for a specific VM.
When possible, the agent is installed by using an Ops Agent OS policy.
For more information, see
Manage VMs covered by the Ops Agent OS policy.
Ops Agent OS policies aren't supported on all versions of all operating
systems. In this case, clicking Install/Update Ops Agent provides
a series of commands to run in Cloud Shell.
The Ops Agent collects both metrics and logs by default. You can change
this default behavior by
configuring the Ops Agent.
Optional tasks
This section describes how to perform common maintenance tasks.
Enable structured logging
When you run the installation script on a Linux VM, the script by default
installs the google-fluentd-catch-all package when the --also-install flag
is present. In order to switch to structured logging, complete the following
steps.
Back up any local changes to /etc/google-fluentd/config.d/.
Run one of the following commands, depending on your Linux distribution:
For information about structured logging, refer to the
structured logging guide.
Configuring the Logging agent
The agent comes preconfigured to monitor certain known log locations. On Linux,
those locations are described in the package google-fluentd-catch-all-config,
which is automatically pulled in by the installation script. On Windows, the
agent monitors the Windows Event Log by default.
If you use an HTTP proxy for proxying requests to the Logging and
Monitoring APIs, do the following:
Linux
Edit the following configuration file (create the file if it doesn't already
exist):
/etc/default/google-fluentd
Add the following to the file:
exporthttp_proxy="http://proxy-ip:proxy-port"exporthttps_proxy="http://proxy-ip:proxy-port"exportno_proxy=169.254.169.254# Skip proxy for the local Metadata Server.
Restart the agent by running the following command on your VM instance:
sudo service google-fluentd restart
Windows
If you use an HTTP proxy, run the following command from an
administrator command prompt. This sets the
http_proxy and https_proxy
environment variables so that the agent can send data using outbound HTTPS:
To upgrade to the latest agent release, install the newest agent as described in
Installing on Windows on this page. The installer prompts you
to uninstall the previous version of the agent.
List all agent versions
To list the available versions of the agent, run the following command:
CENTOS / RHEL
List the available versions of the agent:
sudo yum list --showduplicates google-fluentd
DEBIAN / UBUNTU
List the available versions of the agent:
sudo apt-cache madison google-fluentd
SLES / SUSE
List the available versions of the agent:
sudo zypper search -s google-fluentd
WINDOWS
Installing earlier versions of the agent on Windows is not supported.
Uninstall the agent
To remove the Logging agent and its configuration files, use the
following instructions.
After you uninstall the agent, the Google Cloud console might take up to one
hour to report this change.
Linux
Run the following command:
sudo bash add-logging-agent-repo.sh --uninstall
Optionally, to remove the repository in addition to uninstalling the agent,
append --remove-repo to the previous command.
Windows
In the Windows Control Panel, choose Uninstall a program. You should see the
Logging agent in the list of programs that you can uninstall. You can also
run uninstall.exe from the directory where you installed the
Logging agent.
VMs without remote package access
Installing the Logging agent requires access to
remote package repositories, for both the agent package and (on Linux) its
dependencies.
If you are using VPC-SC or a private network,
the network configuration might also affect your ability to install agent
dependencies from upstream repositories. The agent packages themselves are
accessible by using Private Google
Access. This can be configured
following Enable Private Google
Access.
If your VM host's security policy denies access to remote package repositories,
we recommend creating a custom VM
image with the
agent pre-installed and disabling package management in that image.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2026-06-09 UTC."],[],[]]