Log
Source: log.
A log is a named collection of entries, each entry representing a timestamped
event. Logs can be produced by Google Cloud Platform services, by third-party
services, or by your applications. For example, the log apache-access is
produced by the Apache Web Server, but the log
compute.googleapis.com/activity_log is produced by Google Compute Engine.
Property
Method
new Log(logging, name[, options])
Example
const {Logging} = require('@google-cloud/logging');
const logging = new Logging();
const log = logging.log('syslog');
Parameters
| Name | Type | Optional | Description | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
|
logging |
|
|
Logging instance. |
||||||||
|
name |
|
|
Name of the log. |
||||||||
|
options |
|
Yes |
Configuration object. Values in
|
- See also
Property
name string
Method
getEntriesStream([query]) → ReadableStream
This method is a wrapper around {module:logging#getEntriesStream}, but with a filter specified to only return {module:logging/entry} objects from this log.
Example
const {Logging} = require('@google-cloud/logging');
const logging = new Logging();
const log = logging.log('my-log');
log.getEntriesStream()
.on('error', console.error)
.on('data', entry => {
// `entry` is a Stackdriver Logging entry object.
// See the `data` property to read the data from the entry.
})
.on('end', function() {
// All entries retrieved.
});
//-
// If you anticipate many results, you can end a stream early to prevent
// unnecessary processing and API requests.
//-
log.getEntriesStream()
.on('data', function(entry) {
this.end();
});
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
query |
GetEntriesRequest |
Yes |
Query object for listing entries. |
- Returns
-
ReadableStreamA readable stream that emits Entry instances.