Delete a Logtail configuration
You can call the DeleteConfig API operation to delete a specified Logtail configuration from a project.
Prerequisites
-
Simple Log Service is activated. For more information, see Activate Simple Log Service.
-
The Simple Log Service SDK for Python is initialized. For more information, see Initialize Simple Log Service SDK for Python.
Parameter description
def delete_logtail_config(self, project_name, config_name):
Request parameters
|
Parameter |
Type |
Required |
Description |
|
project_name |
String |
Yes |
The name of the project. The project in Simple Log Service is used to isolate the resources of different users and control access to specific resources. See Manage projects. |
|
config_name |
String |
Yes |
The name of the Logtail configuration. For more information, see Logtail (legacy) |
Response parameters
For more information about response parameters, see DeleteConfig.
Sample Code
from aliyun.log import LogClient
import os
# In this example, the AccessKey ID and AccessKey secret are obtained 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', '')
# Specify a Simple Log Service endpoint.
endpoint = "ap-southeast-1.log.aliyuncs.com"
client = LogClient(endpoint, access_key_id, access_key_secret)
project = "slsproject-1"
config_name = "logstore-1-stt1-logtail"
def main():
# Delete the Logtail configuration.
try:
res = client.delete_logtail_config(project, config_name)
res.log_print()
except Exception as error:
print(error)
if __name__ == '__main__':
main()
Sample response
DeleteLogtailConfigResponse:
headers: {'Server': 'AliyunSLS', 'Content-Length': '0', 'Connection': 'keep-alive', 'Access-Control-Allow-Origin': '*', 'Date': 'Fri, 22 Nov 2024 07:37:54 GMT', 'x-log-time': '1732261074', 'x-log-requestid': '674034D2AFFB50836FFE36A7'}
Process finished with exit code 0
References
-
The following API operations are available for managing Logtail configurations:
-
For more sample code, see Alibaba Cloud Simple Log Service SDK for Python on GitHub.