Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions plugins/custom_calyptia/calyptia.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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),
Expand Down
13 changes: 12 additions & 1 deletion plugins/in_calyptia_fleet/in_calyptia_fleet.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -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.
*/
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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),
Expand Down