[Yandex Cloud documentation](../../../index.md) > [Yandex Serverless Containers](../../index.md) > [Concepts](../index.md) > [Trigger](index.md) > Trigger for Yandex Cloud Logging

# Trigger for Cloud Logging that invokes a Serverless Containers container

A [trigger](index.md) for Cloud Logging invokes a Serverless Containers [container](../container.md) when messages are received in a [log group](../../../logging/concepts/log-group.md).

A trigger for Cloud Logging needs a [service account](../../../iam/concepts/users/service-accounts.md) to read messages from the log group and invoke a container.

For more information about creating a trigger for Cloud Logging, see [Creating a trigger for Cloud Logging that invokes a container from Serverless Containers](../../operations/cloud-logging-trigger-create.md).

## Message batching {#batching}

Batching settings allow you to send multiple messages to a container at the same time. They set a top limit on the message batch size and accumulation time. For example, if the message batch size is `3`, the container can receive batches of one to three messages.

## Roles required for the proper operation of a trigger for Cloud Logging {#roles}

* To create a trigger, you need a permission for the service account under which the trigger runs the operation. This permission comes with the [iam.serviceAccounts.user](../../../iam/concepts/access-control/roles.md#sa-user) and [editor](../../../iam/concepts/access-control/roles.md#editor) roles or higher.
* For the trigger to fire, the service account needs the following roles:
    * `serverless-containers.containerInvoker` for the container the trigger invokes.
    * `logging.reader` for the log group that will fire the trigger when entries are added to it.

## Format of the message from the trigger for Cloud Logging {#format}

After the trigger is activated, it sends the following message to the container:

```json
{
   "messages":[
      {
         "event_metadata":{
            "event_id":"2c59a567-6666-4b65-a0b0-cc12********",
            "event_type":"yandex.cloud.events.serverless.triggers.LoggingMessageBatch",
            "created_at":{
               "seconds":1630607359,
               "nanos":6794776
            }
         },
         "details":{
            "messages":[
               {
                  "resource":{
                     "type":"serverless.function",
                     "id":"b09tm9raoev5********"
                  },
                  "timestamp":"2021-09-02 18:29:17.118082213 +0000 UTC",
                  "level":"INFO",
                  "message":"START RequestID: 085035c7-2319-40dd-bb03-fd8t******** Version: b09s5cq4b935********",
                  "json_payload":{
                     "request_id":"085035c7-2319-40dd-bb03-fdb2********",
                     "version_id":"b09s5cq4b935********"
                  }
               }
            ]
         }
      }
   ]
}
```

## Useful links {#see-also}

* [Trigger for Cloud Logging that invokes a Cloud Functions function](../../../functions/concepts/trigger/cloud-logging-trigger.md)
* [Trigger for Cloud Logging that sends messages to WebSocket connections](../../../api-gateway/concepts/trigger/cloud-logging-trigger.md)