diff --git a/plugins/out_azure_blob/azure_blob.c b/plugins/out_azure_blob/azure_blob.c index 98a1ff8807f..c13da85204d 100644 --- a/plugins/out_azure_blob/azure_blob.c +++ b/plugins/out_azure_blob/azure_blob.c @@ -517,7 +517,9 @@ static int create_container(struct flb_azure_blob *ctx, char *name) /* * Check that the container exists, if it doesn't and the configuration property * auto_create_container is enabled, it will send a request to create it. If it - * could not be created or auto_create_container is disabled, it returns FLB_FALSE. + * could not be created, it returns FLB_FALSE. + * If auto_create_container is disabled, it will return FLB_TRUE assuming the container + * already exists. */ static int ensure_container(struct flb_azure_blob *ctx) { @@ -528,8 +530,15 @@ static int ensure_container(struct flb_azure_blob *ctx) struct flb_http_client *c; struct flb_connection *u_conn; + if (!ctx->auto_create_container) { + flb_plg_info(ctx->ins, "auto_create_container is disabled, assuming container '%s' already exists", + ctx->container_name); + return FLB_TRUE; + } + uri = azb_uri_ensure_or_create_container(ctx); if (!uri) { + flb_plg_error(ctx->ins, "cannot create container URI"); return FLB_FALSE; } @@ -582,8 +591,17 @@ static int ensure_container(struct flb_azure_blob *ctx) return ret; } else if (status == 200) { + flb_plg_info(ctx->ins, "container '%s' already exists", ctx->container_name); return FLB_TRUE; + } + else if (status == 403) { + flb_plg_error(ctx->ins, "failed getting container '%s', access denied", + ctx->container_name); + return FLB_FALSE; } + + flb_plg_error(ctx->ins, "get container request failed, status=%i", + status); return FLB_FALSE; }