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

# Deleting a log group

{% note info %}

The name of the [default log group](../concepts/log-group.md) is `default`. You can delete it. However, the system will automatically recreate it if a service or application writes logs targeting the folder ID.

{% endnote %}

{% list tabs group=instructions %}

- Management console {#console}

    1. In the [management console](https://console.yandex.cloud), select the folder where you want to delete a [log group](../concepts/log-group.md).
    1. [Go](../../console/operations/select-service.md#select-service) to **Cloud Logging**.
    1. Next to the log group, click ![image](../../_assets/console-icons/ellipsis.svg) and select **Delete**.
    1. In the window that opens, click **Delete**.

- 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 delete a log group, run this command:

    ```
    yc logging group delete --name=group
    ```

    Result:

    ```
    done (1s)
    id: af3flf29t8**********
    folder_id: aoek6qrs8t**********
    cloud_id: aoegtvhtp8**********
    created_at: "2023-06-24T09:56:38.970Z"
    name: group
    status: ACTIVE
    retention_period: 3600s
    ```

- 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 delete a log group created with Terraform:

  1. Open the Terraform configuration file and delete the section describing the log group.
     
     {% cut "Example of a log group description in the Terraform configuration" %}

     ```hcl
     ...
     resource "yandex_logging_group" "group1" {
       name      = "test-logging-group"
       folder_id = "${data.yandex_resourcemanager_folder.test_folder.id}"
     }
     ...
     ```

     {% endcut %}

  1. In the command line, navigate to the directory with the Terraform configuration file.

  1. Check the configuration using this command:

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

  1. Run this command:

     ```
     terraform plan
     ```
  
     You will see a detailed list of resources. No changes will be made at this step. If the configuration contains any errors, Terraform will show them.

  1. Apply the changes:

     ```
     terraform apply
     ```

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

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

     ```
     yc logging group list
     ```

- API {#api}

  To delete a custom log group, use the [delete](../api-ref/LogGroup/delete.md) REST API method for the [LogGroup](../api-ref/LogGroup/index.md) resource or the [LogGroupService/Delete](../api-ref/grpc/LogGroup/delete.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.

  Run this query:
  
  ```bash
  grpcurl -rpc-header "Authorization: Bearer $(yc iam create-token)" \
     -d '{"log_group_id": "<log_group_ID>"}' \
     -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.Delete
  ```

  Response:

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

{% endlist %}