View a markdown version of this page

Gunakan DeleteSyslogConfigurationdengan AWS SDK - CloudWatch Log Amazon

Terjemahan disediakan oleh mesin penerjemah. Jika konten terjemahan yang diberikan bertentangan dengan versi bahasa Inggris aslinya, utamakan versi bahasa Inggris.

Gunakan DeleteSyslogConfigurationdengan AWS SDK

Contoh kode berikut menunjukkan cara menggunakanDeleteSyslogConfiguration.

Contoh tindakan adalah kutipan kode dari program yang lebih besar dan harus dijalankan dalam konteks. Anda dapat melihat tindakan ini dalam konteks dalam contoh kode berikut:

Python
SDK untuk Python (Boto3)
catatan

Ada lebih banyak tentang GitHub. Temukan contoh lengkapnya dan pelajari cara mengatur dan menjalankannya di Repositori Contoh Kode AWS.

def delete_syslog_configuration( self, log_group_identifier: str, vpc_endpoint_id: str ) -> None: """ Deletes a syslog configuration for a log group. After deletion, syslog data is no longer ingested through the specified VPC endpoint. :param log_group_identifier: The name or ARN of the log group. :param vpc_endpoint_id: The ID of the VPC endpoint associated with the syslog configuration. :raises ClientError: If the syslog configuration does not exist (in which case the error is logged but not re-raised during cleanup). """ try: self.logs_client.delete_syslog_configuration( logGroupIdentifier=log_group_identifier, vpcEndpointId=vpc_endpoint_id, ) logger.info( "Deleted syslog configuration for log group '%s' and VPC endpoint '%s'.", log_group_identifier, vpc_endpoint_id, ) except ClientError as error: if error.response["Error"]["Code"] == "ResourceNotFoundException": logger.info( "Syslog configuration does not exist or was already deleted: %s", error.response["Error"]["Message"], ) else: logger.error( "Failed to delete syslog configuration: %s", error.response["Error"]["Message"], ) raise

Untuk daftar lengkap panduan pengembang AWS SDK dan contoh kode, lihatMenggunakan CloudWatch Log dengan AWS SDK. Topik ini juga mencakup informasi tentang memulai dan detail tentang versi SDK sebelumnya.