Service for ingesting and querying logs.
Equality
Instances of this class created via copy-construction or copy-assignment always compare equal. Instances created with equal std::shared_ptr<*Connection>
objects compare equal. Objects that compare equal share the same underlying resources.
Performance
Creating a new instance of this class is a relatively expensive operation, new objects establish new connections to the service. In contrast, copy-construction, move-construction, and the corresponding assignment operations are relatively efficient as the copies share all underlying resources.
Thread Safety
Concurrent access to different instances of this class, even if they compare equal, is guaranteed to work. Two or more threads operating on the same instance of this class is not guaranteed to work. Since copy-construction and move-construction is a relatively efficient operation, consider using such a copy when using this class from multiple threads.
Constructors
LoggingServiceV2Client(LoggingServiceV2Client const &)
Copy and move support
Parameter | |
---|---|
Name | Description |
|
LoggingServiceV2Client const &
|
LoggingServiceV2Client(LoggingServiceV2Client &&)
Copy and move support
Parameter | |
---|---|
Name | Description |
|
LoggingServiceV2Client &&
|
LoggingServiceV2Client(std::shared_ptr< LoggingServiceV2Connection >, Options)
Parameters | |
---|---|
Name | Description |
connection |
std::shared_ptr< LoggingServiceV2Connection >
|
opts |
Options
|
Operators
operator=(LoggingServiceV2Client const &)
Copy and move support
Parameter | |
---|---|
Name | Description |
|
LoggingServiceV2Client const &
|
Returns | |
---|---|
Type | Description |
LoggingServiceV2Client & |
operator=(LoggingServiceV2Client &&)
Copy and move support
Parameter | |
---|---|
Name | Description |
|
LoggingServiceV2Client &&
|
Returns | |
---|---|
Type | Description |
LoggingServiceV2Client & |
Functions
DeleteLog(std::string const &, Options)
Deletes all the log entries in a log for the _Default Log Bucket.
The log reappears if it receives new entries. Log entries written shortly before the delete operation might not be deleted. Entries received after the delete operation with a timestamp before the operation will be deleted.
Parameters | |
---|---|
Name | Description |
log_name |
std::string const &
Required. The resource name of the log to delete:
|
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
Status | a |
DeleteLog(google::logging::v2::DeleteLogRequest const &, Options)
Deletes all the log entries in a log for the _Default Log Bucket.
The log reappears if it receives new entries. Log entries written shortly before the delete operation might not be deleted. Entries received after the delete operation with a timestamp before the operation will be deleted.
Parameters | |
---|---|
Name | Description |
request |
google::logging::v2::DeleteLogRequest const &
Unary RPCs, such as the one wrapped by this function, receive a single |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
Status | a |
WriteLogEntries(std::string const &, google::api::MonitoredResource const &, std::map< std::string, std::string > const &, std::vector< google::logging::v2::LogEntry > const &, Options)
Writes log entries to Logging.
This API method is the only way to send log entries to Logging. This method is used, directly or indirectly, by the Logging agent (fluentd) and all logging libraries configured to use Logging. A single request may contain log entries for a maximum of 1000 different resources (projects, organizations, billing accounts or folders)
Parameters | |
---|---|
Name | Description |
log_name |
std::string const &
Optional. A default log resource name that is assigned to all log entries in
|
resource |
google::api::MonitoredResource const &
Optional. A default monitored resource object that is assigned to all log entries in |
labels |
std::map< std::string, std::string > const &
Optional. Default labels that are added to the |
entries |
std::vector< google::logging::v2::LogEntry > const &
Required. The log entries to send to Logging. The order of log entries in this list does not matter. Values supplied in this method's |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StatusOr< google::logging::v2::WriteLogEntriesResponse > | the result of the RPC. The response message type (google.logging.v2.WriteLogEntriesResponse) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |
WriteLogEntries(google::logging::v2::WriteLogEntriesRequest const &, Options)
Writes log entries to Logging.
This API method is the only way to send log entries to Logging. This method is used, directly or indirectly, by the Logging agent (fluentd) and all logging libraries configured to use Logging. A single request may contain log entries for a maximum of 1000 different resources (projects, organizations, billing accounts or folders)
Parameters | |
---|---|
Name | Description |
request |
google::logging::v2::WriteLogEntriesRequest const &
Unary RPCs, such as the one wrapped by this function, receive a single |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StatusOr< google::logging::v2::WriteLogEntriesResponse > | the result of the RPC. The response message type (google.logging.v2.WriteLogEntriesResponse) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |
ListLogEntries(std::vector< std::string > const &, std::string const &, std::string const &, Options)
Lists log entries.
Use this method to retrieve log entries that originated from a project/folder/organization/billing account. For ways to export log entries, see Exporting Logs.
Parameters | |
---|---|
Name | Description |
resource_names |
std::vector< std::string > const &
Required. Names of one or more parent resources from which to retrieve log entries:
|
filter |
std::string const &
Optional. Only log entries that match the filter are returned. An empty filter matches all log entries in the resources listed in |
order_by |
std::string const &
Optional. How the results should be sorted. Presently, the only permitted values are |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StreamRange< google::logging::v2::LogEntry > | a StreamRange to iterate of the results. See the documentation of this type for details. In brief, this class has |
ListLogEntries(google::logging::v2::ListLogEntriesRequest, Options)
Lists log entries.
Use this method to retrieve log entries that originated from a project/folder/organization/billing account. For ways to export log entries, see Exporting Logs.
Parameters | |
---|---|
Name | Description |
request |
google::logging::v2::ListLogEntriesRequest
Unary RPCs, such as the one wrapped by this function, receive a single |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StreamRange< google::logging::v2::LogEntry > | a StreamRange to iterate of the results. See the documentation of this type for details. In brief, this class has |
ListMonitoredResourceDescriptors(google::logging::v2::ListMonitoredResourceDescriptorsRequest, Options)
Lists the descriptors for monitored resource types used by Logging.
Parameters | |
---|---|
Name | Description |
request |
google::logging::v2::ListMonitoredResourceDescriptorsRequest
Unary RPCs, such as the one wrapped by this function, receive a single |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StreamRange< google::api::MonitoredResourceDescriptor > | a StreamRange to iterate of the results. See the documentation of this type for details. In brief, this class has |
ListLogs(std::string const &, Options)
Lists the logs in projects, organizations, folders, or billing accounts.
Only logs that have entries are listed.
Parameters | |
---|---|
Name | Description |
parent |
std::string const &
Required. The resource name to list logs for:
|
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StreamRange< std::string > | a StreamRange to iterate of the results. See the documentation of this type for details. In brief, this class has |
ListLogs(google::logging::v2::ListLogsRequest, Options)
Lists the logs in projects, organizations, folders, or billing accounts.
Only logs that have entries are listed.
Parameters | |
---|---|
Name | Description |
request |
google::logging::v2::ListLogsRequest
Unary RPCs, such as the one wrapped by this function, receive a single |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StreamRange< std::string > | a StreamRange to iterate of the results. See the documentation of this type for details. In brief, this class has |
AsyncTailLogEntries(Options)
Streaming read of log entries as they are ingested.
Until the stream is terminated, it will continue reading logs.
Parameter | |
---|---|
Name | Description |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
std::unique_ptr<::google::cloud::AsyncStreamingReadWriteRpc< google::logging::v2::TailLogEntriesRequest, google::logging::v2::TailLogEntriesResponse > > | An object representing the bidirectional streaming RPC. Applications can send multiple request messages and receive multiple response messages through this API. Bidirectional streaming RPCs can impose restrictions on the sequence of request and response messages. Please consult the service documentation for details. The request message type (google.logging.v2.TailLogEntriesRequest) and response messages (google.logging.v2.TailLogEntriesResponse) are mapped to C++ classes using the Protobuf mapping rules. |
AsyncWriteLogEntries(std::string const &, google::api::MonitoredResource const &, std::map< std::string, std::string > const &, std::vector< google::logging::v2::LogEntry > const &, Options)
Writes log entries to Logging.
This API method is the only way to send log entries to Logging. This method is used, directly or indirectly, by the Logging agent (fluentd) and all logging libraries configured to use Logging. A single request may contain log entries for a maximum of 1000 different resources (projects, organizations, billing accounts or folders)
Parameters | |
---|---|
Name | Description |
log_name |
std::string const &
Optional. A default log resource name that is assigned to all log entries in
|
resource |
google::api::MonitoredResource const &
Optional. A default monitored resource object that is assigned to all log entries in |
labels |
std::map< std::string, std::string > const &
Optional. Default labels that are added to the |
entries |
std::vector< google::logging::v2::LogEntry > const &
Required. The log entries to send to Logging. The order of log entries in this list does not matter. Values supplied in this method's |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
future< StatusOr< google::logging::v2::WriteLogEntriesResponse > > | the result of the RPC. The response message type (google.logging.v2.WriteLogEntriesResponse) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |
AsyncWriteLogEntries(google::logging::v2::WriteLogEntriesRequest const &, Options)
Writes log entries to Logging.
This API method is the only way to send log entries to Logging. This method is used, directly or indirectly, by the Logging agent (fluentd) and all logging libraries configured to use Logging. A single request may contain log entries for a maximum of 1000 different resources (projects, organizations, billing accounts or folders)
Parameters | |
---|---|
Name | Description |
request |
google::logging::v2::WriteLogEntriesRequest const &
Unary RPCs, such as the one wrapped by this function, receive a single |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
future< StatusOr< google::logging::v2::WriteLogEntriesResponse > > | the result of the RPC. The response message type (google.logging.v2.WriteLogEntriesResponse) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |