Skip to content

Commit

Permalink
http: add http prefix to all http specific error messages in the inte…
Browse files Browse the repository at this point in the history
…rnal log

Signed-off-by: Balazs Scheidler <balazs.scheidler@axoflow.com>
  • Loading branch information
bazsi committed Apr 21, 2024
1 parent 0c29f97 commit 6feddac
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
30 changes: 15 additions & 15 deletions modules/http/http-worker.c
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ static LogThreadedResult
_default_1XX(HTTPDestinationWorker *self, const gchar *url, glong http_code)
{
HTTPDestinationDriver *owner = (HTTPDestinationDriver *) self->super.owner;
msg_error("Server returned with a 1XX (continuation) status code, which was not handled by curl. ",
msg_error("http: Server returned with a 1XX (continuation) status code, which was not handled by curl. ",
evt_tag_str("url", url),
evt_tag_int("status_code", http_code),
evt_tag_str("driver", owner->super.super.super.id),
Expand All @@ -338,7 +338,7 @@ static LogThreadedResult
_default_3XX(HTTPDestinationWorker *self, const gchar *url, glong http_code)
{
HTTPDestinationDriver *owner = (HTTPDestinationDriver *) self->super.owner;
msg_notice("Server returned with a 3XX (redirect) status code. "
msg_notice("http: Server returned with a 3XX (redirect) status code. "
"Either accept-redirect() is set to no, or this status code is unknown.",
evt_tag_str("url", url),
evt_tag_int("status_code", http_code),
Expand All @@ -354,7 +354,7 @@ static LogThreadedResult
_default_4XX(HTTPDestinationWorker *self, const gchar *url, glong http_code)
{
HTTPDestinationDriver *owner = (HTTPDestinationDriver *) self->super.owner;
msg_notice("Server returned with a 4XX (client errors) status code, which means we are not "
msg_notice("http: Server returned with a 4XX (client errors) status code, which means we are not "
"authorized or the URL is not found.",
evt_tag_str("url", url),
evt_tag_int("status_code", http_code),
Expand All @@ -376,7 +376,7 @@ static LogThreadedResult
_default_5XX(HTTPDestinationWorker *self, const gchar *url, glong http_code)
{
HTTPDestinationDriver *owner = (HTTPDestinationDriver *) self->super.owner;
msg_notice("Server returned with a 5XX (server errors) status code, which indicates server failure.",
msg_notice("http: Server returned with a 5XX (server errors) status code, which indicates server failure.",
evt_tag_str("url", url),
evt_tag_int("status_code", http_code),
evt_tag_str("driver", owner->super.super.super.id),
Expand Down Expand Up @@ -411,7 +411,7 @@ default_map_http_status_to_worker_status(HTTPDestinationWorker *self, const gcha
case 5:
return _default_5XX(self, url, http_code);
default:
msg_error("Unknown HTTP response code",
msg_error("http: Unknown HTTP response code",
evt_tag_str("url", url),
evt_tag_int("status_code", http_code),
evt_tag_str("driver", owner->super.super.super.id),
Expand Down Expand Up @@ -461,7 +461,7 @@ _debug_response_info(HTTPDestinationWorker *self, const gchar *url, glong http_c

curl_easy_getinfo(self->curl, CURLINFO_TOTAL_TIME, &total_time);
curl_easy_getinfo(self->curl, CURLINFO_REDIRECT_COUNT, &redirect_count);
msg_debug("curl: HTTP response received",
msg_debug("http: HTTP response received",
evt_tag_str("url", url),
evt_tag_int("status_code", http_code),
evt_tag_int("body_size", self->request_body->len),
Expand Down Expand Up @@ -531,7 +531,7 @@ _curl_perform_request(HTTPDestinationWorker *self, const gchar *url)
{
HTTPDestinationDriver *owner = (HTTPDestinationDriver *) self->super.owner;

msg_trace("Sending HTTP request",
msg_trace("http: Sending HTTP request",
evt_tag_str("url", url));

curl_easy_setopt(self->curl, CURLOPT_URL, url);
Expand All @@ -557,7 +557,7 @@ _curl_perform_request(HTTPDestinationWorker *self, const gchar *url)
CURLcode ret = curl_easy_perform(self->curl);
if (ret != CURLE_OK)
{
msg_error("curl: error sending HTTP request",
msg_error("http: error sending HTTP request",
evt_tag_str("url", url),
evt_tag_str("error", curl_easy_strerror(ret)),
evt_tag_int("worker_index", self->super.worker_index),
Expand All @@ -577,7 +577,7 @@ _curl_get_status_code(HTTPDestinationWorker *self, const gchar *url, glong *http

if (ret != CURLE_OK)
{
msg_error("curl: error querying response code",
msg_error("http: error querying response code",
evt_tag_str("url", url),
evt_tag_str("error", curl_easy_strerror(ret)),
evt_tag_int("worker_index", self->super.worker_index),
Expand Down Expand Up @@ -663,7 +663,7 @@ _flush_on_target(HTTPDestinationWorker *self, const gchar *url)

if (signal_data.result == HTTP_SLOT_RESOLVED)
{
msg_debug("HTTP error resolved issue, retry",
msg_debug("http: HTTP error resolved issue, retry",
evt_tag_long("http_code", http_code));
return LTR_RETRY;
}
Expand All @@ -682,13 +682,13 @@ _format_request_headers_report_error(GError *error)
{
if (error->code == HTTP_HEADER_FORMAT_SLOT_CRITICAL_ERROR)
{
msg_error("Failed to format HTTP request headers.",
msg_error("http: Failed to format HTTP request headers",
evt_tag_str("reason", error->message),
evt_tag_printf("action", "request disconnect"));
}
else
{
msg_warning("Failed to format HTTP request headers",
msg_warning("http: Failed to format HTTP request headers",
evt_tag_str("reason", error->message),
evt_tag_printf("action", "trying to send the request"));
}
Expand Down Expand Up @@ -765,7 +765,7 @@ _flush(LogThreadedDestWorker *s, LogThreadedFlushMode mode)
alt_target = http_load_balancer_choose_target(owner->load_balancer, &self->lbc);
if (alt_target == target)
{
msg_debug("Target server down, but no alternative server available. Falling back to retrying after time-reopen()",
msg_debug("http: Target server down, but no alternative server available. Falling back to retrying after time-reopen()",
evt_tag_str("url", url),
evt_tag_int("worker_index", self->super.worker_index),
evt_tag_str("driver", owner->super.super.super.id),
Expand All @@ -774,7 +774,7 @@ _flush(LogThreadedDestWorker *s, LogThreadedFlushMode mode)
}

const gchar *alt_url = _get_url(self, alt_target);
msg_debug("Target server down, trying an alternative server",
msg_debug("http: Target server down, trying an alternative server",
evt_tag_str("url", url),
evt_tag_str("alternative_url", alt_url),
evt_tag_int("worker_index", self->super.worker_index),
Expand Down Expand Up @@ -871,7 +871,7 @@ _init(LogThreadedDestWorker *s)
self->request_headers = http_curl_header_list_new();
if (!(self->curl = curl_easy_init()))
{
msg_error("curl: cannot initialize libcurl",
msg_error("http: cannot initialize libcurl",
evt_tag_int("worker_index", self->super.worker_index),
evt_tag_str("driver", owner->super.super.super.id),
log_pipe_location_tag(&owner->super.super.super.super));
Expand Down
6 changes: 3 additions & 3 deletions modules/http/http.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ http_dd_set_method(LogDriver *d, const gchar *method)
self->method_type = METHOD_TYPE_PUT;
else
{
msg_warning("Unsupported method is set(Only POST and PUT are supported), default method POST will be used",
msg_warning("http: Unsupported method is set(Only POST and PUT are supported), default method POST will be used",
evt_tag_str("method", method));
self->method_type = METHOD_TYPE_POST;
}
Expand Down Expand Up @@ -297,7 +297,7 @@ http_dd_set_accept_encoding(LogDriver *d, const gchar *encoding)
self->accept_encoding = g_string_new(encoding);
#else
self->accept_encoding = NULL;
msg_warning("libcurl has been compiled without libZ support. Accept Encoding not supported",
msg_warning("http: libcurl has been compiled without compression support. accept-encoding() not supported",
evt_tag_str("encoding", encoding));
#endif
}
Expand Down Expand Up @@ -445,7 +445,7 @@ http_dd_init(LogPipe *s)
if ((self->super.batch_lines || self->batch_bytes) && http_load_balancer_is_url_templated(self->load_balancer) &&
self->super.num_workers > 1 && !self->super.worker_partition_key)
{
msg_error("worker-partition-key() must be set if using templates in the url() option "
msg_error("http: worker-partition-key() must be set if using templates in the url() option "
"while batching is enabled and multiple workers are configured. "
"Make sure to set worker-partition-key() with a template that contains all the templates "
"used in the url() option",
Expand Down

0 comments on commit 6feddac

Please sign in to comment.