[Yandex Cloud documentation](../../index.md) > [Yandex Cloud Logging](../index.md) > [Step-by-step guides](index.md) > Managing a log group > Updating a log group

# Updating a log group

{% list tabs group=instructions %}

- Management console {#console}

    1. In the [management console](https://console.yandex.cloud), select the folder containing your [log group](../concepts/log-group.md).
    1. [Navigate](../../console/operations/select-service.md#select-service) to **Cloud Logging**.
    1. Next to the log group, click ![image](../../_assets/console-icons/ellipsis.svg).
    1. In the menu that opens, click **Edit**.
    1. Update the log group settings.
    1. Click **Save**.

- CLI {#cli}

    If you do not have the Yandex Cloud CLI yet, [install and initialize it](../../cli/quickstart.md#install).

    The folder used by default is the one specified when [creating](../../cli/operations/profile/profile-create.md) the CLI profile. To change the default folder, use the `yc config set folder-id <folder_ID>` command. You can also specify a different folder for any command using `--folder-name` or `--folder-id`. If you access a resource by its name, the search will be limited to the default folder. If you access a resource by its ID, the search will be global, i.e., through all folders based on access permissions.

    To access a log group, use its name or unique ID. To find them out, [get](list.md) a list of log groups in the folder.

    To update [log group](../concepts/log-group.md) settings, such as the record retention period, run this command:

    ```
    yc logging group update --name=default --retention-period=24h
    ```

    Where:

    * `--name`: Name of the log group whose record retention period you want to update.
    * `--retention-period`: New retention period for log group records.

        You can only set the record retention period in hours, minutes, or seconds, e.g., `1h` or `1440m`.

    Result:

    ```
    id: af3mu6hnd0**********
    folder_id: aoek6qrs8t**********
    cloud_id: aoegtvhtp8**********
    created_at: "2023-06-22T09:51:43.614Z"
    name: default
    status: ACTIVE
    retention_period: 86400s
    ```

- Terraform {#tf}

  If you do not have Terraform yet, [install it and configure the Yandex Cloud provider](../../tutorials/infrastructure-management/terraform-quickstart.md#install-terraform).
  
  
  To manage infrastructure using Terraform under a service account or user accounts (a Yandex account, a federated account, or a local user), [authenticate](../../terraform/authentication.md) using the appropriate method.

  To update the settings of a [log group](../concepts/log-group.md) created with Terraform:

  1. Open the Terraform configuration file and edit the setting, such as the record retention period, in the log group description as needed:

     ```hcl
     ...
     resource "yandex_logging_group" "group1" {
       name             = "test-logging-group"
       folder_id        = "<folder_ID>"
       retention_period = "5h"
     }
     ...
     ```

     Where:

     * `name`: Log group name. This is an optional setting.
     * `folder_id`: Folder ID. This is an optional setting. It defaults to the value specified in the provider settings.
     * `retention_period`: New retention period for log group records.

        You can only set the record retention period in hours, minutes, or seconds, e.g., `1h` or `1440m`.

     For more on the properties of the `yandex_logging_group` resource, see [this provider guide](../../terraform/resources/logging_group.md).

  1. Validate your configuration using this command:

     ```
     terraform validate
     ```
     
     If the configuration is valid, you will get this message:
     
     ```
     Success! The configuration is valid.
     ```

  1. Run this command:

     ```
     terraform plan
     ```
  
     You will see a list of resources and their properties. No changes will be made at this step. Terraform will show any errors in the configuration.

  1. Apply the configuration changes:

     ```
     terraform apply
     ```
     
  1. Type `yes` and press **Enter** to confirm the changes.

     You can check the log group update in the [management console](https://console.yandex.cloud) or using this [CLI](../../cli/quickstart.md) command:

     ```
     yc logging group get <log_group_name>
     ```

- API {#api}

  To update a log group, use the [update](../api-ref/LogGroup/update.md) REST API method for the [LogGroup](../api-ref/LogGroup/index.md) resource or the [LogGroupService/Update](../api-ref/grpc/LogGroup/update.md) gRPC API call.

  **Request example**

  The example below uses `grpcurl`. To run this example, [authenticate](../api-ref/authentication.md) with the API and clone the [cloudapi](https://github.com/yandex-cloud/cloudapi) repository.

  In our example, we are updating the record retention period.
  
  Create a file named `payload.json`:

  ```json
  {
     "log_group_id": "<log_group_ID>",
     "retention_period": "24h",
     "update_mask": {
        "paths": ["retention_period"]
     }
  }
  ```

  Send this request:

  ```bash
  grpcurl -rpc-header "Authorization: Bearer $(yc iam create-token)" \
    -d @ \
    -import-path ~/cloudapi/ \
    -import-path ~/cloudapi/third_party/googleapis/ \
    -proto ~/cloudapi/yandex/cloud/logging/v1/log_group_service.proto \
  logging.api.cloud.yandex.net:443 yandex.cloud.logging.v1.LogGroupService.Update < payload.json
  ```

  Response:

  ```text
  {
    "id": "e23omac87b3a********",
    "description": "Update log group",
    "createdAt": "2023-03-25T05:39:24.058608338Z",
    "createdBy": "ajego134p5h1********",
    "modifiedAt": "2023-03-25T05:39:24.058608338Z",
    "metadata": {
      "@type": "type.googleapis.com/yandex.cloud.logging.v1.UpdateLogGroupMetadata",
      "logGroupId": "e23ff0on5amv********"
    }
  }
  ```

{% endlist %}