Skip to content
Open
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
5 changes: 4 additions & 1 deletion plugins/out_cloudwatch_logs/cloudwatch_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,7 @@ int pack_emf_payload(struct flb_cloudwatch *ctx,
mk_list_foreach_safe(metric_head, metric_temp, flb_intermediate_metrics) {
an_item = mk_list_entry(metric_head, struct flb_intermediate_metric, _head);
if (should_add_to_emf(an_item) == 1) {
msgpack_pack_map(&mp_pck, 2);
msgpack_pack_map(&mp_pck, 3);
msgpack_pack_str(&mp_pck, 4);
msgpack_pack_str_body(&mp_pck, "Name", 4);
msgpack_pack_object(&mp_pck, an_item->key);
Expand All @@ -759,6 +759,9 @@ int pack_emf_payload(struct flb_cloudwatch *ctx,
msgpack_pack_str(&mp_pck, strlen(an_item->metric_unit));
msgpack_pack_str_body(&mp_pck, an_item->metric_unit,
strlen(an_item->metric_unit));
msgpack_pack_str(&mp_pck, 17);
msgpack_pack_str_body(&mp_pck, "StorageResolution", 17);
msgpack_pack_int(&mp_pck, ctx->metric_storage_resolution);
}
}

Expand Down
21 changes: 17 additions & 4 deletions plugins/out_cloudwatch_logs/cloudwatch_logs.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,19 +195,26 @@ static int cb_cloudwatch_init(struct flb_output_instance *ins,
}

tmp = flb_output_get_property("metric_namespace", ins);
if (tmp)
{
if (tmp) {
flb_plg_info(ctx->ins, "Metric Namespace=%s", tmp);
ctx->metric_namespace = flb_sds_create(tmp);
}

tmp = flb_output_get_property("metric_dimensions", ins);
if (tmp)
{
if (tmp) {
flb_plg_info(ctx->ins, "Metric Dimensions=%s", tmp);
ctx->metric_dimensions = flb_utils_split(tmp, ';', 256);
}

tmp = flb_output_get_property("metric_storage_resolution", ins);
if (tmp) {
flb_plg_info(ctx->ins, "Metric Storage Resolution=%s", tmp);
ctx->metric_storage_resolution = atoi(tmp);
} else {
/* Default to 60s storage resolution as does CloudWatch if not specified */
ctx->metric_storage_resolution = 60;
}

ctx->create_group = FLB_FALSE;
tmp = flb_output_get_property("auto_create_group", ins);
if (tmp) {
Expand Down Expand Up @@ -676,6 +683,12 @@ static struct flb_config_map config_map[] = {
"is 'd1,d2;d3', we will consider it as [[d1, d2],[d3]]."
},

{
FLB_CONFIG_MAP_STR, "metric_storage_resolution", NULL,
0, FLB_FALSE, 0,
"Metric storage resolution for CloudWatch EMF logs"
},

{
FLB_CONFIG_MAP_STR, "profile", NULL,
0, FLB_TRUE, offsetof(struct flb_cloudwatch, profile),
Expand Down
2 changes: 2 additions & 0 deletions plugins/out_cloudwatch_logs/cloudwatch_logs.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,8 @@ struct flb_cloudwatch {
is 'd1,d2;d3', we will consider it as [[d1, d2],[d3]]*/
struct mk_list *metric_dimensions;

int metric_storage_resolution;

/* Plugin output instance reference */
struct flb_output_instance *ins;
};
Expand Down
Loading