Deleting a log group
Note
The name of the default log group is default
. The group can be deleted. However, if a service or application writes logs and the folder ID is indicated as the destination, it will be automatically recreated.
- In the management console
, select the folder where you want to delete a log group. - Select Cloud Logging.
- In the log group row, click
and select Delete. - In the window that opens, click Delete.
If you do not have the Yandex Cloud command line interface yet, install and initialize it.
The folder specified in the CLI profile is used by default. You can specify a different folder using the --folder-name
or --folder-id
parameter.
To access a log group, use its name or unique ID. To find them, get a list of log groups in the folder.
To delete a log group, run the 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
If you don't have Terraform, install it and configure the Yandex Cloud provider.
To delete a log group created with Terraform:
-
Open the Terraform configuration file and delete the section with the log group description.
Example log group description in Terraform configuration
... resource "yandex_logging_group" "group1" { name = "test-logging-group" folder_id = "${data.yandex_resourcemanager_folder.test_folder.id}" } ...
-
In the command line, go to the directory with the Terraform configuration file.
-
Check the configuration using this command:
terraform validate
If the configuration is correct, you will get this message:
Success! The configuration is valid.
-
Run this command:
terraform plan
The terminal will display a list of resources with parameters. No changes will be made at this step. If the configuration contains any errors, Terraform will point them out.
-
Apply the configuration changes:
terraform apply
-
Confirm the changes: type
yes
into the terminal and press Enter.You can check the update using the management console
or this CLI command:yc logging group list
To delete a custom log group, use the delete REST API method for the LogGroup resource or the LogGroupService/Delete gRPC API call.
Sample request
The example below uses the grpcurl
utility. To use the example, authenticate in the API and clone the cloudapi
Run the following query:
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:
{
"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********"
}
}