@@ -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 ctx -> key_name = NULL ;
106107 ctx -> reserve_data = FLB_FALSE ;
@@ -352,16 +353,14 @@ static int cb_parser_filter(const void *data, size_t bytes,
352353 out_buf = strdup (parsed_buf );
353354 out_size = parsed_size ;
354355 }
355- if (ctx -> hash_value_field ) {
356+ if (ctx -> hash_value_field != NULL ) {
356357 char * new_buf = NULL ;
357358 size_t new_size ;
358359 int ret ;
359- flb_sds_t hash_key = flb_sds_create ("parsed" );
360360 ret = flb_msgpack_append_map_to_record (& new_buf , & new_size ,
361- hash_key ,
361+ ctx -> hash_value_field ,
362362 out_buf , out_size ,
363363 parsed_buf ,parsed_size );
364- flb_sds_destroy (hash_key );
365364 if ( ret != FLB_MAP_EXPAND_SUCCESS ){
366365 flb_plg_error (ctx -> ins , "cannot append parsed entry to record" );
367366
@@ -470,9 +469,9 @@ static struct flb_config_map config_map[] = {
470469 "If false, all other original fields will be removed."
471470 },
472471 {
473- FLB_CONFIG_MAP_BOOL , "Hash_Value_Field" , "false" ,
472+ FLB_CONFIG_MAP_STR , "Hash_Value_Field" , NULL ,
474473 0 , FLB_TRUE , offsetof(struct filter_parser_ctx , hash_value_field ),
475- "Stores the parsed values as a hash value in a field with key `parsed` . "
474+ "Stores the parsed values as a hash value in a field with key given . "
476475 },
477476 {
478477 FLB_CONFIG_MAP_DEPRECATED , "Unescape_key" , NULL ,
0 commit comments