Disabling Bucket Logging
If you have any questions during development, post them on the Issues page of GitHub.
You can call set_bucket_logging_configuration_ob to delete all logs of a bucket to disable logging of the bucket. Sample code is as follows:
static void test_close_bucket_logging_configuration() { obs_status ret_status = OBS_STATUS_BUTT; // Create and initialize option. obs_options option; init_obs_options(&option); option.bucket_options.host_name = "<your-endpoint>"; option.bucket_options.bucket_name = "<Your bucketname>"; // Hard-coded or plaintext AK/SK are risky. For security purposes, encrypt your AK/SK and store them in the configuration file or environment variables. In this example, the AK/SK are stored in environment variables for identity authentication. Before running this example, configure environment variables ACCESS_KEY_ID and SECRET_ACCESS_KEY. // Obtain an AK/SK pair on the management console. For details, see https://support.huaweicloud.com/eu/usermanual-ca/ca_01_0003.html. option.bucket_options.access_key = getenv("ACCESS_KEY_ID"); option.bucket_options.secret_access_key = getenv("SECRET_ACCESS_KEY"); // Set response callback function. obs_response_handler response_handler = { 0, &response_complete_callback }; // Disable bucket logging. set_bucket_logging_configuration_obs(&option, NULL, NULL, NULL, NULL, &response_handler, &ret_status); if (ret_status == OBS_STATUS_OK) { printf("close bucket(%s) logging successfully. \n",bucket_name_src); } else { printf("close bucket logging failed(%s).\n",obs_get_status_name(ret_status)); } }
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.