---
title: "Delete logs"
sidebar_label: "Delete logs"
description: "How to delete log groups and log streams"
sidebar_position: 6
---

import Formbricks from '@theme/MDXComponents/Formbricks';
import MoreVerticalIcon from '@selectel/docux/icons/more-vertical';
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import {TabItemLabel} from '@selectel/docux/components';

# Delete log entries

You can delete log entries. To do this, [delete a log group](#delete-log-group) or [selected log streams](#delete-event-stream):

You can delete logs:

* via the [control panel](https://my.selectel.ru/logs/default/logs);
* using [AWS CLI](/logs/tools/aws-cli.mdx);
* or an [SDK client](/logs/tools/sdk-client.mdx).

If the logged resource continues to work and creates new logs, the deleted streams and groups will be restored automatically. Deleted events will not be restored.

## Delete a log group \{#delete-log-group}

:::danger

When deleting a log group, all streamers and events of this group will be deleted. :::

<Tabs queryString="delete-log-group">
  <TabItem value="panel">
    <TabItemLabel>
      Control panel
    </TabItemLabel>

    1. In the [control panel](https://my.selectel.ru/logs/default/logs/), on the top menu, click **Products** and select **Logs**.

    2. In the **Logs** section, in the <MoreVerticalIcon /> menu of the log group, select **Delete log group**.

    3. Enter the log group name to confirm the deletion.

    4. Click **Delete**.
  </TabItem>

  <TabItem value="sdk-client">
    <TabItemLabel>
      SDK client
    </TabItemLabel>

    <Tabs>
      <TabItem value="python">
        <TabItemLabel>
          Python
        </TabItemLabel>

        1. Create or open a client script file.

        2. Add code to your script to delete a log group:

           ```python
           response = client.delete_log_group(
                       logGroupName=<log_group_name>
                   )
           ```

           Specify `<log_group_name>` — the name of the log group you need to delete. You can view the list of log groups in the [control panel](https://my.selectel.ru/logs/default/logs).

        3. Run the script.
      </TabItem>

      <TabItem value="go">
        <TabItemLabel>
          Go
        </TabItemLabel>

        1. Create or open a client script file.

        2. Add code to your script to delete a log group:

           ```go
           resp, err := client.DeleteLogGroup(context.TODO(), &cloudwatchlogs.DeleteLogGroupInput{
               LogGroupName: aws.String("<log_group_name>"),
           })
           ```

           Specify `<log_group_name>` — the name of the log group to delete. You can view the list of log groups in the [control panel](https://my.selectel.ru/logs/default/logs).

        3. Run the script.
      </TabItem>
    </Tabs>
  </TabItem>

  <TabItem value="aws-cli">
    <TabItemLabel>
      AWS CLI
    </TabItemLabel>

    1. Open the CLI.

    2. To delete a log group, run the command:

       ```bash
       aws logs delete-log-group- -log-group-name <log_group_name> 
       ```

       Specify `<log_group_name>` — the name of the log group, for example, `s/lbaas/Bellatrix-lb`. You can view the list of log groups using the `aws logs describe-log-groups` command or in the [control panel](https://my.selectel.ru/logs/default/logs).
  </TabItem>
</Tabs>

## Delete a log stream \{#delete-event-stream}

:::warning

When you delete a log stream, the events included in this stream will be deleted.

:::

<Tabs queryString="delete-log-group">
  <TabItem value="panel">
    <TabItemLabel>
      Control panel
    </TabItemLabel>

    1. In the [control panel](https://my.selectel.ru/vpc/default/servers/), click **Products** in the top menu and select **Logs**.

    2. In the **Logs** section, in the <MoreVerticalIcon /> menu of the log group, select **Delete selected log streams**.

    3. Select the log streams.

    4. Enter the log group name to confirm the deletion.

    5. Click **Delete**.
  </TabItem>

  <TabItem value="sdk-client">
    <TabItemLabel>
      SDK client
    </TabItemLabel>

    <Tabs>
      <TabItem value="python">
        <TabItemLabel>
          Python
        </TabItemLabel>

        1. Create or open a client script file.

        2. Add code to your script to delete a log stream:

           ```python
           response = client.delete_log_stream(
                       logGroupName=<log_group_name>,
                       logStreamName=<log_stream_name>
                   )
           ```

           Specify:

           * `<log_group_name>` — the name of the log group that contains the event stream. You can view the list of log groups in the [control panel](https://my.selectel.ru/logs/default/logs);
           * `<log_stream_name>` — the name of the event stream you want to delete. You can view the list of event streams in the [control panel](https://my.selectel.ru/logs/default/logs).

        3. Run the script.
      </TabItem>

      <TabItem value="go">
        <TabItemLabel>
          Go
        </TabItemLabel>

        1. Create or open a client script file.

        2. Add code to your script to delete a log stream:

           ```go
           resp, err := client.DeleteLogStream(context.TODO(), &cloudwatchlogs.DeleteLogStreamInput{
               LogGroupName:  aws.String("<log_group_name>"),
               LogStreamName: aws.String("<log_stream_name>"),
           })
           ```

           Specify:

           * `<log_group_name>` — the name of the log group that contains the event stream. You can view the list of log groups in the [control panel](https://my.selectel.ru/logs/default/logs);
           * `<log_stream_name>` — the name of the event stream to delete. You can view the list of event streams in the [control panel](https://my.selectel.ru/logs/default/logs).

        3. Run the script.
      </TabItem>
    </Tabs>
  </TabItem>

  <TabItem value="aws-cli">
    <TabItemLabel>
      AWS CLI
    </TabItemLabel>

    1. Open the CLI.

    2. To delete an event stream, run the command:

       ```bash
       aws logs delete-log-stream --log-group-name <log_group_name> --log-stream-name <log_stream_name>
       ```

       Specify:

       * `<log_group_name>` — the name of the log group, for example, `s/lbaas/Bellatrix-lb`. You can view the list of log groups using the `aws logs describe-log-groups` command or in the [control panel](https://my.selectel.ru/logs/default/logs);
       * `<log_stream_name>` — the name of the event stream, for example, `http-b964dde5-7080-4169-8f9e-127bd59c89ca`. You can view the list of event streams using the `aws logs describe-log-streams --log-group-name <log_group_name>` command or in the [control panel](https://my.selectel.ru/logs/default/logs).
  </TabItem>
</Tabs>

<Formbricks />
