Delete a logstore

Updated at:

Deletes a specified Logstore, including all shard data and indexes, by calling the DeleteLogStore operation.

Prerequisites

Ensure that you have:

Parameters

def delete_logstore(self, project_name, logstore_name):

Request parameters

Parameter

Type

Required

Description

project_name

String

Yes

Project name: The name of the project that contains the Logstore to delete. For more information, see Manage projects.

logstore_name

String

Yes

Logstore name: The name of the Logstore to delete. For more information, see Manage a logstore.

Response parameters

For details about response parameters, see DeleteLogStore.

Sample code

from aliyun.log import LogClient
import os

# Obtain the AccessKey ID and AccessKey Secret from environment variables.
access_key_id = os.environ.get('ALIBABA_CLOUD_ACCESS_KEY_ID', '')
access_key_secret = os.environ.get('ALIBABA_CLOUD_ACCESS_KEY_SECRET', '')
# The Log Service endpoint.
endpoint = "cn-hangzhou.log.aliyuncs.com"

# Instantiate the LogClient class.
client = LogClient(endpoint, access_key_id, access_key_secret)

project_name = 'slsproject-1'
logstore_name = "logstore-1"


def main():
    # Delete the specified logstore.
    res = client.delete_logstore(project_name, logstore_name)
    res.log_print()


if __name__ == '__main__':
    main()

Sample response

DeleteLogStoreResponse:
headers: {'Server': 'AliyunSLS', 'Content-Length': '0', 'Connection': 'keep-alive', 'Access-Control-Allow-Origin': '*', 'Date': 'Fri, 22 Nov 2024 08:17:51 GMT', 'x-log-time': '1732263471', 'x-log-requestid': '67403E2FC9FBC6BE834C****'}

Process finished with exit code 0

References