From syslog-ng Premium Edition (syslog-ng PE) version 7.0.21, you can use the the google_pubsub() destination to generate your own messaging Google Pub/Sub infrastructure with syslog-ng PE as a "Publisher" entity, utilizing the HTTP REST interface of the service.
Similarly to syslog-ng PE's stackdriver() destination, the google_pubsub() destination is an asynchronous messaging service connected to Google's infrastructure.
For more information about Google Pub/Sub's messaging service, see What Is Pub/Sub?. The rest of this section and its subsections assume that you are familiar with the Google Pub/Sub messaging service, and its concepts and terminology.
From syslog-ng PE version 7.0.24, the following endpoints are available for the google_pubsub() destination:
-
The global REST/HTTP endpoint (default)
By default, the google_pubsub() destination uses the global REST/HTTP endpoint, which automatically redirects requests to a nearby region.
The default global REST/HTTP endpoint for Google Pub/Sub services, which is also the default configuration option for the google_pubsub(), destination, is "https://pubsub.googleapis.com".
-
Your custom service endpoint (optional)
From version 7.0.24, the syslog-ng PE application supports including the service_endpoint() option to configure an additional service endpoint in addition to the default global REST/HTTP endpoint.
For more information, see the description and list of available Google Pub/Sub service endpoints.
NOTE: Configuring the service_endpoint() option for the google_pubsub(), destination is optional, and it does not affect the default global REST/HTTP endpoint in any way.
Configuring the service-endpoint() option for the google_pubsub() destination
You can configure your google_pubsub() destination to route messages to regional service endpoints in addition to the default global REST/HTTP endpoint by including the service_endpoint() option in your configuration.
Example: configuring the service_endpoint() option for the google_pubsub() destination
You can include the service_endpoint() option for the google_pubsub() destination as follows:
destination {
google_pubsub(
...
service_endpoint("https://southamerica-east1-pubsub.googleapis.com")
);
};
|
CAUTION: When configuring the service_endpoint()option, make sure you include the https:// part of the endpoint URL. To avoid mistakes, One Identity recommends that you copy the REST/HTTP endpoint column of your choice as-is, directly from the table of the listed available regional endpoints.
For example:
Figure 27: Available regional endpoint URLs for Google Pub/Sub
The example above illustrates the REST/HTTP endpoint URL of the southamerica-east1 region, which is the same region that is included in the configuration example. |
The following table describes the possible error messages that you may encounter while using the google_pubsub() destination.
400 |
"error": {
"code": 400,
"message": "The value for message_count is too large. You passed 1001 in the request, but the maximum value is 1000.",
"status": "INVALID_ARGUMENT"
} |
There are too many messages in one batch. Google Pub/Sub allows maximum 1000 messages per batch. |
Decrease the value of the batch-lines() option if you modified it previously. |
400 |
"error": {
"code": 400,
"message": "Request payload size exceeds the limit: 10485760 bytes.",
"status": "INVALID_ARGUMENT"
} |
The batch size is too large. Google Pub/Sub allows maximum 10MB per batch. |
To overcome the issue, try one of the following methods:
|
403 |
"error": {
"code": 403,
"message": "User not authorized to perform this action.",
"status": "PERMISSION_DENIED"
} |
One of the following possible reasons behind the error message:
- Wrong credentials.
- Insufficient permissions.
|
To overcome the issue, try one of the following methods:
- Check your credentials .JSON file that you downloaded from the UI of Google Pub/Sub.
- Check the associated "roles" of your service account. The google_pubsub() destination requires the "Pub/Sub Publisher" role to operate.
|
404 |
"error": {
"code": 404,
"message": "Requested project not found or user does not have access to it (project=YOUR_PROJECT). Make sure to specify the unique project identifier and not the Google Cloud Console display name.",
"status": "NOT_FOUND"
} |
You have specified an incorrect project ID. The string YOUR_PROJECT is the project name provided in the configuration. and the project name you have to specify. |
The project name you can find on the Pub/Sub UI is not necessarily the same as the project ID you specified in the YOUR_PROJECT string in your configuration. Make sure you use the project name provided in the YOUR_PROJECT string in your configuration. |
404 |
"error": {
"code": 404,
"message": "Resource not found (resource=YOUR_TOPIC).",
"status": "NOT_FOUND"
} |
You have specified an incorrect topic ID. The string YOUR_TOPIC is the topic ID you provided in the configuration, and the topic ID you have to specify. |
Make sure you use the topic ID you provided in the YOUR_TOPIC string in the configuration, and make sure that you have sufficient permissions to access it. |
429 |
"error": { "code": 429, "message": "Quota exceeded for quota metric 'Regional publisher throughput, kB' and limit 'Regional publisher throughput, kB per minute per region' of service 'pubsubgoogleapiscom' for consumer 'project_number:127287437417'", "status": "RESOURCE_EXHAUSTED"}
|
This error indicates that you have exceeded the quota for the given Google Cloud project. |
Review your Google Cloud project's quota and adjust it according to Google's documentation if necessary. |
From syslog-ng Premium Edition (syslog-ng PE) version 7.0.32, you can use the the google_pubsub_managedaccount() destination to generate your own messaging Google Pub/Sub infrastructure with syslog-ng PE as a Google Cloud managed service account authenticated "Publisher" entity, utilizing the HTTP REST interface of the service. This authentication method requires syslog-ng PE to run inside Google Cloud (for example, on a VM instance running in Google Cloud Compute Engine).
The google_pubsub_managedaccount() destination is equivalent to syslog-ng PE's google_pubsub(): Sending logs to the Google Cloud Pub/Sub messaging service, only the authentication method is different.
Similarly to syslog-ng PE's stackdriver: Sending logs to the Google Stackdriver cloud, the google_pubsub_managedaccount() destination is an asynchronous messaging service connected to Google's infrastructure.
For more information about Google Pub/Sub's messaging service, see What Is Pub/Sub?. The rest of this section and its subsections assume that you are familiar with the Google Pub/Sub messaging service, and its concepts, and terminology.
The current implementation of the google_pubsub() and google_pubsub_managedaccount() destinations has the following limitations:
No message-based acknowledgement: While Google Pub/Sub acknowledges the batch of received messages, it also sends individual acknowledgement ID's to each message. However, we currently do not track individual messages inside Google Pub/Sub. Under normal operation circumstances, the lack of tracking individual messages has no effect on message delivery, and even allows flow control to work properly. However, in case of an error, the only solution is to repeat the entire batch, which can lead to message duplication in case Google Pub/Sub acknowledged part of the previous batch despite indicating an overall error.
NOTE: This behavior, called At-Least-Once delivery, means that if an error occurs, it is more acceptable to duplicate messages than to lose any of them.
NOTE: Typically, only the central syslog-ng PE server uses this destination. For more information on the server mode, see Server mode.
NOTE: The google_pubsub() and google_pubsub_managedaccount() destinations cannot fetch logs, they only serve as "Publisher" entities in the Google Pub/Sub service.