Skip to content

Commit 1d2dd91

Browse files
committed
out_prometheus_remote_write: Add AWS credentials refresh to out_prometheus_remote_write.
This fix handles case of AWS credentials expiration when fluentd cannot send logs due to expired AWS credentials. Signed-off-by: Tradunsky <tradunskih@gmail.com>
1 parent 964ebca commit 1d2dd91

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

plugins/out_prometheus_remote_write/remote_write.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ static int http_post(struct prometheus_remote_write_context *ctx,
183183
* - 200: OK
184184
* - 201: Created
185185
* - 202: Accepted
186-
* - 203: no authorative resp
186+
* - 203: no authoritative resp
187187
* - 204: No Content
188188
* - 205: Reset content
189189
*
@@ -200,10 +200,16 @@ static int http_post(struct prometheus_remote_write_context *ctx,
200200
flb_plg_error(ctx->ins, "%s:%i, HTTP status=%i",
201201
ctx->host, ctx->port, c->resp.status);
202202
}
203+
#if defined(FLB_HAVE_SIGNV4) && defined(FLB_HAVE_AWS)
204+
if (c->resp.status == 403 && ctx->has_aws_auth == FLB_TRUE) {
205+
flb_plg_info(ctx->ins, "auth error, refreshing creds");
206+
ctx->aws_provider->provider_vtable->refresh(ctx->aws_provider);
207+
}
208+
#endif
203209
out_ret = FLB_RETRY;
204210
}
205211
else if (c->resp.status == 400) {
206-
/* Returned 400 status means unrecoverable. Immidiately
212+
/* Returned 400 status means unrecoverable. Immediately
207213
* returning as a error. */
208214
if (ctx->log_response_payload &&
209215
c->resp.payload && c->resp.payload_size > 0) {

0 commit comments

Comments
 (0)