Trigger for Cloud Logs
Alert
Triggers for Cloud Logs are deprecated. Use triggers for Cloud Logging.
A trigger for Cloud Logs runs a function when messages are received in a log group. The trigger must be in the same folder as the log groups it is subscribed to.
Alert
Triggers for Cloud Logs may skip messages under increased load. To make sure you don't lose them, in the trigger settings for Cloud Logs, specify DLQ and process messages from there with a trigger for Message Queue.
A trigger for Cloud Logs needs a service account to invoke the function.
Batching
Batching settings let you simultaneously send multiple messages to a function. They set a top limit on the size of a message group and its accumulation time. For example, if the size of a message group is 3, the function can receive groups that contain from 1 to 3 messages.
Roles required for the proper operation of a trigger for Cloud Logs
- To create a trigger, you need a permission for a service account that runs the trigger executing the operation. This permission is included in the roles iam.serviceAccounts.user, editor, and higher.
- To run a trigger, the service account needs the
serverless.functions.invoker
role for the folder containing the function called by the trigger.
Read more about access management.
Cloud Logs trigger message format
After the trigger is activated, it sends the following message to the function:
{
"messages": [
{
"event_metadata": {
"event_id": "564ab7ff-5890-4eca-b8ab-************",
"event_type": "yandex.cloud.events.serverless.triggers.CloudLogsMessageBatch",
"created_at": {
"seconds": 1599563113,
"nanos": 647071528
}
},
"details": {
"messages": [
{
"log_group_id": "eol1fphr************",
"log_stream_name": "log-stream-name",
"message": "message-1",
"timestamp": "2020-09-08T11:05:10Z"
},
{
"log_group_id": "eol1fphr************",
"log_stream_name": "log-stream-name",
"message": "message-2",
"timestamp": "2020-09-08T11:05:10Z"
}
]
}
}
]
}