@@ -101,6 +101,7 @@ static int configure(struct filter_parser_ctx *ctx,
101101 int ret ;
102102 struct mk_list * head ;
103103 struct flb_kv * kv ;
104+ ctx -> hash_value_field = NULL ;
104105
105106 mk_list_init (& ctx -> parsers );
106107
@@ -349,16 +350,14 @@ static int cb_parser_filter(const void *data, size_t bytes,
349350 out_buf = strdup (parsed_buf );
350351 out_size = parsed_size ;
351352 }
352- if (ctx -> hash_value_field ) {
353+ if (ctx -> hash_value_field != NULL ) {
353354 char * new_buf = NULL ;
354355 size_t new_size ;
355356 int ret ;
356- flb_sds_t hash_key = flb_sds_create ("parsed" );
357357 ret = flb_msgpack_append_map_to_record (& new_buf , & new_size ,
358- hash_key ,
358+ ctx -> hash_value_field ,
359359 out_buf , out_size ,
360360 parsed_buf ,parsed_size );
361- flb_sds_destroy (hash_key );
362361 if ( ret != FLB_MAP_EXPAND_SUCCESS ){
363362 flb_plg_error (ctx -> ins , "cannot append parsed entry to record" );
364363
@@ -467,9 +466,9 @@ static struct flb_config_map config_map[] = {
467466 "If false, all other original fields will be removed."
468467 },
469468 {
470- FLB_CONFIG_MAP_BOOL , "Hash_Value_Field" , "false" ,
469+ FLB_CONFIG_MAP_STR , "Hash_Value_Field" , NULL ,
471470 0 , FLB_TRUE , offsetof(struct filter_parser_ctx , hash_value_field ),
472- "Stores the parsed values as a hash value in a field with key `parsed` . "
471+ "Stores the parsed values as a hash value in a field with key given . "
473472 },
474473 {
475474 FLB_CONFIG_MAP_DEPRECATED , "Unescape_key" , NULL ,
0 commit comments