diff --git a/plugins/custom_calyptia/calyptia.c b/plugins/custom_calyptia/calyptia.c index 4aba53ca79c..c3554157598 100644 --- a/plugins/custom_calyptia/calyptia.c +++ b/plugins/custom_calyptia/calyptia.c @@ -60,6 +60,7 @@ struct calyptia { flb_sds_t fleet_id; /* fleet-id */ flb_sds_t fleet_name; flb_sds_t fleet_config_dir; /* fleet configuration directory */ + flb_sds_t fleet_max_http_buffer_size; int fleet_interval_sec; int fleet_interval_nsec; }; @@ -497,6 +498,9 @@ static int cb_calyptia_init(struct flb_custom_instance *ins, flb_input_set_property(ctx->fleet, "config_dir", ctx->fleet_config_dir); } + if (ctx->fleet_max_http_buffer_size) { + flb_input_set_property(ctx->fleet, "max_http_buffer_size", ctx->fleet_max_http_buffer_size); + } if (ctx->machine_id) { flb_input_set_property(ctx->fleet, "machine_id", ctx->machine_id); } @@ -592,6 +596,11 @@ static struct flb_config_map config_map[] = { 0, FLB_TRUE, offsetof(struct calyptia, fleet_interval_nsec), "Set the collector interval (nanoseconds)" }, + { + FLB_CONFIG_MAP_STR, "fleet.max_http_buffer_size", NULL, + 0, FLB_TRUE, offsetof(struct calyptia, fleet_max_http_buffer_size), + "Max HTTP buffer size for fleet" + }, { FLB_CONFIG_MAP_STR, "fleet_name", NULL, 0, FLB_TRUE, offsetof(struct calyptia, fleet_name), diff --git a/plugins/in_calyptia_fleet/in_calyptia_fleet.c b/plugins/in_calyptia_fleet/in_calyptia_fleet.c index 1e46640b53e..0128733aed6 100644 --- a/plugins/in_calyptia_fleet/in_calyptia_fleet.c +++ b/plugins/in_calyptia_fleet/in_calyptia_fleet.c @@ -57,6 +57,8 @@ #define DEFAULT_INTERVAL_SEC "15" #define DEFAULT_INTERVAL_NSEC "0" +#define DEFAULT_MAX_HTTP_BUFFER_SIZE "10485760" + #define CALYPTIA_HOST "cloud-api.calyptia.com" #define CALYPTIA_PORT "443" @@ -73,6 +75,9 @@ struct flb_in_calyptia_fleet_config { int interval_sec; int interval_nsec; + /* maximum http buffer size */ + int max_http_buffer_size; + /* Grabbed from the cfg_path, used to check if configuration has * has been updated. */ @@ -504,6 +509,7 @@ static void *do_reload(void *data) static int test_config_is_valid(struct flb_in_calyptia_fleet_config *ctx, flb_sds_t cfgpath) { + return FLB_TRUE; struct flb_cf *conf; int ret = FLB_FALSE; @@ -894,7 +900,7 @@ static struct flb_http_client *fleet_http_do(struct flb_in_calyptia_fleet_config goto http_client_error; } - flb_http_buffer_size(client, 8192); + flb_http_buffer_size(client, ctx->max_http_buffer_size); flb_http_add_header(client, CALYPTIA_H_PROJECT, sizeof(CALYPTIA_H_PROJECT) - 1, @@ -2301,6 +2307,11 @@ static struct flb_config_map config_map[] = { 0, FLB_TRUE, offsetof(struct flb_in_calyptia_fleet_config, machine_id), "Agent Machine ID." }, + { + FLB_CONFIG_MAP_INT, "max_http_buffer_size", DEFAULT_MAX_HTTP_BUFFER_SIZE, + 0, FLB_TRUE, offsetof(struct flb_in_calyptia_fleet_config, max_http_buffer_size), + "Set the maximum size for http buffers when communicating with the API" + }, { FLB_CONFIG_MAP_INT, "interval_sec", DEFAULT_INTERVAL_SEC, 0, FLB_TRUE, offsetof(struct flb_in_calyptia_fleet_config, interval_sec),