Delete logs
You can delete log entries. To do this, delete a log group or selected log streams:
You can delete the logs:
- through the control panel;
- using the AWS CLI;
- or SDK client.
If the logged resource continues to work and creates new logs, deleted Streams and Groups will be restored automatically. Deleted events will not be restored.
Delete a group of logs
Deleting a log group will delete all streams and events in that group. :::
Control panel
SDK client
AWS CLI
-
In the Dashboard, on the top menu, click Products and select Logs.
-
Go to the Logs section.
-
From the menu of the log group, select Delete Log Group.
-
Enter the name of the log group to confirm the deletion.
-
Click Delete.
Python
Go
-
Create or open a client script file.
-
Add code to the script to delete a group of logs:
response = client.delete_log_group(
logGroupName=<log_group_name>
)Specify
<log_group_name>- the name of the log group you want to delete. The list of log groups can be viewed in the control panel. -
Run the script.
-
Create or open a client script file.
-
Add code to the script to delete a group of logs:
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 be deleted. The list of log groups can be viewed in the control panel. -
Run the script.
-
Open the CLI.
-
To delete a log group, run the command:
aws logs delete-log-group- -log-group-name <log_group_name>Specify
<log_group_name>- the name of the log group, for examples/lbaas/Bellatrix-lb. The list of log groups can be viewed using theaws logs describe-log-groupscommand or in the control panel.
Delete Streaming Logs
Deleting a log stream will delete the events that are part of that stream.
Control panel
SDK client
AWS CLI
-
In the dashboard, on the top menu, click Products and select Logs.
-
Go to the Logs section.
-
From the menu of the log group, select Delete Selected Log Streams.
-
Select log streams.
-
Enter the name of the log group to confirm the deletion.
-
Click Delete.
Python
Go
-
Create or open a client script file.
-
Add code to the script to remove stream logs:
response = client.delete_log_stream(
logGroupName=<log_group_name>,
logStreamName=<log_stream_name>
)Specify:
<log_group_name>- name of the log group that contains the event stream. The list of log groups can be viewed in the control panel;<log_stream_name>- name of the event stream to be deleted. The list of event streams can be viewed in the control panel.
-
Run the script.
-
Create or open a client script file.
-
Add code to the script to remove stream logs:
resp, err := client.DeleteLogStream(context.TODO(), &cloudwatchlogs.DeleteLogStreamInput{
LogGroupName: aws.String("<log_group_name>"),
LogStreamName: aws.String("<log_stream_name>"),
})Specify:
<log_group_name>- name of the log group that contains the event stream. The list of log groups can be viewed in the control panel;<log_stream_name>- name of the event stream to be deleted. The list of event streams can be viewed in the control panel.
-
Run the script.
-
Open the CLI.
-
To delete an event stream, run the command:
aws logs delete-log-stream --log-group-name <log_group_name> --log-stream-name <log_stream_name>Specify:
<log_group_name>- log group name, e.g.s/lbaas/Bellatrix-lb.. The list of log groups can be viewed with the commandaws logs describe-log-groupsor in control panel;<log_stream_name>- event stream name, e.g.http-b964dde5-7080-4169-8f9e-127bd59c89ca. The list of event streams can be viewed with the commandaws logs describe-log-streams --log-group-name <log_group_name>or in control panel.