Cloud Logging API overview (original) (raw)

The Cloud Logging API lets you programmatically accomplish logging-related tasks, including reading and writing log entries, creating log-based metrics, and managing sinks to route logs.

See the following reference documentation for the Logging API:

For details on the limits that apply to your usage of the Logging API, see Logging API quotas and limits.

Service endpoint

A service endpoint is a base URL that specifies the network address of an API service. Logging has both global and regional endpoints. You can use a global or regional service endpoint to make requests to Logging:

Enable the Logging API

The Logging API must be enabled before it can be used. For instructions, seeEnable the Logging API.

Access the Logging API

You can indirectly invoke the Logging API by using a command-line interface or a client library written to support a high-level programming language. For more information, see the following reference documentation:

Optimize usage of the Logging API

Following are some tips for using the Logging API effectively.

Read and list logs efficiently

To efficiently use your entries.list quota, try the following:

Write logs efficiently

To efficiently use your entries.write quota, increase your batch volume to support a larger number of log entries per request, which helps reduce the number of writes made per request. Logging supports requests with up to 10MB of data.

Bulk retrieval of log entries

The method you use to retrieve log entries isentries.list, but this method isn't intended for high-volume retrieval of log entries. Using this method in this way might quickly exhaust your quota for read requests.

If you need contemporary or continuous querying, or bulk retrieval of log entries, thenconfigure sinks to send your log entries to Pub/Sub. When you create a Pub/Sub sink, you send the log entries that you want to process to a Pub/Sub topic, and then consume the log entries from there.

This approach has the following advantages:

You can create Pub/Sub sinks to route log entries to a variety of analytics platforms. For an example, seeScenarios for routing Cloud Logging data: Splunk.