Reference documentation and code samples for the Stackdriver Logging Client class Sink.
A sink is used to export log entries outside Stackdriver Logging.
Example:
use Google\Cloud\Logging\LoggingClient;
$logging = new LoggingClient();
$sink = $logging->sink('my-sink');
Methods
__construct
Parameters | |
---|---|
Name | Description |
connection |
Google\Cloud\Logging\Connection\ConnectionInterface
Represents a connection to Cloud Logging. |
name |
string
The sink's name. |
projectId |
string
The project's ID. |
info |
array
[optional] The sink's metadata. |
exists
Check whether or not the sink exists.
Example:
if ($sink->exists()) {
echo 'Sink exists!';
}
Parameter | |
---|---|
Name | Description |
options |
array
[optional] Configuration Options |
Returns | |
---|---|
Type | Description |
bool |
delete
Delete the sink.
Example:
$sink->delete();
Parameter | |
---|---|
Name | Description |
options |
array
[optional] Configuration Options. |
update
Update the sink. Please note this will trigger a network request if cached data is not available to perform the update with.
Example:
$sink->update([
'destination' => 'storage.googleapis.com/my-bucket'
]);
Parameters | |
---|---|
Name | Description |
metadata |
array
The data to update. |
↳ destination |
string
The export destination. Please see Exporting Logs With Sinks for more information and examples. |
↳ filter |
string
|
↳ outputVersionFormat |
string
The log entry version to use for this sink's exported log entries. This version does not have to correspond to the version of the log entry when it was written to Stackdriver Logging. May be either |
options |
array
[optional] Configuration Options. |
Returns | |
---|---|
Type | Description |
array |
info
Retrieves the sink's details. If no sink data is cached a network request will be made to retrieve it.
Example:
$info = $sink->info();
echo $info['destination'];
Parameter | |
---|---|
Name | Description |
options |
array
[optional] Configuration Options. |
Returns | |
---|---|
Type | Description |
array |
reload
Triggers a network request to reload the sink's details.
Example:
$sink->reload();
$info = $sink->info();
echo $info['destination'];
Parameter | |
---|---|
Name | Description |
options |
array
[optional] Configuration Options. |
Returns | |
---|---|
Type | Description |
array |
name
Returns the sink's name.
Example:
echo $sink->name();
Returns | |
---|---|
Type | Description |
string |