@@ -157,6 +157,7 @@ flb_sds_t custom_calyptia_pipeline_config_get(struct flb_config *ctx)
157157 /* Config: [FILTER] */
158158 mk_list_foreach (head , & ctx -> filters ) {
159159 f_ins = mk_list_entry (head , struct flb_filter_instance , _head );
160+
160161 flb_sds_printf (& buf , "[FILTER]\n" );
161162 flb_sds_printf (& buf , " name %s\n" , f_ins -> name );
162163 flb_sds_printf (& buf , " match %s\n" , f_ins -> match );
@@ -168,6 +169,7 @@ flb_sds_t custom_calyptia_pipeline_config_get(struct flb_config *ctx)
168169 /* Config: [OUTPUT] */
169170 mk_list_foreach (head , & ctx -> outputs ) {
170171 o_ins = mk_list_entry (head , struct flb_output_instance , _head );
172+
171173 flb_sds_printf (& buf , "[OUTPUT]\n" );
172174 flb_sds_printf (& buf , " name %s\n" , o_ins -> name );
173175
@@ -231,9 +233,9 @@ static struct flb_output_instance *setup_cloud_output(struct flb_config *config,
231233 int ret ;
232234 struct flb_output_instance * cloud ;
233235 struct mk_list * head ;
234- struct flb_slist_entry * k = NULL ;
235- struct flb_slist_entry * v = NULL ;
236- flb_sds_t kv ;
236+ struct flb_slist_entry * key = NULL ;
237+ struct flb_slist_entry * val = NULL ;
238+ flb_sds_t label ;
237239 struct flb_config_map_val * mv ;
238240
239241 cloud = flb_output_new (config , "calyptia" , ctx , FLB_FALSE );
@@ -254,20 +256,22 @@ static struct flb_output_instance *setup_cloud_output(struct flb_config *config,
254256 }
255257
256258 if (ctx -> add_labels && mk_list_size (ctx -> add_labels ) > 0 ) {
259+
257260 /* iterate all 'add_label' definitions */
258261 flb_config_map_foreach (head , mv , ctx -> add_labels ) {
259- k = mk_list_entry_first (mv -> val .list , struct flb_slist_entry , _head );
260- v = mk_list_entry_last (mv -> val .list , struct flb_slist_entry , _head );
261- kv = flb_sds_create_size (strlen (k -> str ) + strlen (v -> str ) + 1 );
262+ key = mk_list_entry_first (mv -> val .list , struct flb_slist_entry , _head );
263+ val = mk_list_entry_last (mv -> val .list , struct flb_slist_entry , _head );
262264
263- if (!kv ) {
265+ label = flb_sds_create_size (strlen (key -> str ) + strlen (val -> str ) + 1 );
266+
267+ if (!label ) {
264268 flb_free (ctx );
265269 return NULL ;
266270 }
267271
268- flb_sds_printf (& kv , "%s %s" , k -> str , v -> str );
269- flb_output_set_property (cloud , "add_label" , kv );
270- flb_sds_destroy (kv );
272+ flb_sds_printf (& label , "%s %s" , key -> str , val -> str );
273+ flb_output_set_property (cloud , "add_label" , label );
274+ flb_sds_destroy (label );
271275 }
272276 }
273277
@@ -347,6 +351,7 @@ static int cb_calyptia_init(struct flb_custom_instance *ins,
347351 flb_plg_error (ctx -> ins , "could not load metrics collector" );
348352 return -1 ;
349353 }
354+
350355 flb_input_set_property (ctx -> i , "tag" , "_calyptia_cloud" );
351356 flb_input_set_property (ctx -> i , "scrape_on_start" , "true" );
352357 flb_input_set_property (ctx -> i , "scrape_interval" , "30" );
0 commit comments