Many programming languages have standard log-writing interfaces that you can reconfigure to use Logging.
Writing logs
To write logs to Logging, you can do any of the following:
Write your logs to existing log files such as
syslog
on your VM instance. The Logging agent sends the logs to Google Cloud's operations suite. For more information, see About the Agent.Configure a standard logging package to send the logs you write to Logging. For more information, see the following detail pages:
Call the Logging API using Logging's Client Libraries for your programming language.
Call the Logging API REST endpoint directly. See the Logging API reference documentation.
Use the gcloud CLI. For more information, see the gcloud logging command-line interface.
Reading logs
To read log entries in Logging, you can do any of the following:
-
In the Google Cloud console, select Logging, and then select Logs Explorer, or click the following button:
For more information, see Logs Explorer overview.
Call the Logging API through the Client Libraries for your programming language.
Call the Logging API REST endpoints directly. See the Logging API reference documentation.
Use the gcloud CLI. For more information, see the gcloud logging command-line interface.