Skip to content

utils: plugins: Provide a choice for encoding raw UTF-8 strings #10665

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 60 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
0c8557f
utils: Add option for esacape_unicode for choices raw utf-8 or not
cosmo0920 Jul 31, 2025
39bdff7
config: Introduce new config for determine whether escaping unicode o…
cosmo0920 Jul 31, 2025
1fa31c5
pack: Handle escape_unicode arguments
cosmo0920 Jul 31, 2025
657b519
sds: Follow the argument increase
cosmo0920 Jul 31, 2025
55fc283
help: Follow the argument increase
cosmo0920 Jul 31, 2025
3e9d173
record_accessor: Follow the argument change
cosmo0920 Jul 31, 2025
1b0254b
bin: Follow the argument change
cosmo0920 Jul 31, 2025
911d6b4
http_server: Follow to use escape_unicode argument
cosmo0920 Jul 31, 2025
ba3d251
filter_expect: Follow to use escape_unicode argument
cosmo0920 Jul 31, 2025
eb7e3ee
filter_nightfall: Follow to use escape_unicode argument
cosmo0920 Jul 31, 2025
e02505d
filter_wasm: Refer the config whether escaping unicode characters or not
cosmo0920 Jul 31, 2025
8c621a1
out_azure: Refer the config whether esacaping unicode or not in JSON
cosmo0920 Jul 31, 2025
8dea115
out_azure_logs_ingestion: Refer to use a config whether escaping unic…
cosmo0920 Jul 31, 2025
f0aee47
out_bigquery: Refer a config whether escaping unicode or not in JSON
cosmo0920 Jul 31, 2025
5a5c5ff
out_calyptia: Use a flag always to escape unicode
cosmo0920 Jul 31, 2025
cf08efe
out_chronicle: Refer to use a config whether escaping unicode or not …
cosmo0920 Jul 31, 2025
fadc65f
out_cloudwatch: Refer a config whether escaping unicode or not in JSON
cosmo0920 Jul 31, 2025
db51b5b
out_datadog: Refer a config whether escaping unicode or not in JSON
cosmo0920 Jul 31, 2025
a620810
out_es: Refer a config whether escaping unicode or not in JSON
cosmo0920 Jul 31, 2025
4da7fb6
out_http: Refer a config whether escaping unicode or not in JSON
cosmo0920 Jul 31, 2025
5e7ebec
out_influxdb: Refer a config whether escaping unicode or not in JSON
cosmo0920 Jul 31, 2025
cbcf5f3
out_kafka: Refer a config whether escaping unicode or not in JSON
cosmo0920 Jul 31, 2025
ace09f2
out_kafka_rest: Refer a config whether escaping unicode or not in JSON
cosmo0920 Jul 31, 2025
1759a86
out_kinesis_firehose: Refer a config whether escaping unicode or not …
cosmo0920 Jul 31, 2025
02dc227
out_kinesis_streams: Refer a config whether escaping unicode or not i…
cosmo0920 Jul 31, 2025
cb2a2fe
out_lib: Refer a config whether escaping unicode or not in JSON
cosmo0920 Jul 31, 2025
b9f574b
out_logdna: Refer a config whether escaping unicode or not in JSON
cosmo0920 Jul 31, 2025
6b2b124
out_loki: Refer a config whether escaping unicode or not in JSON
cosmo0920 Jul 31, 2025
7a546b9
out_nats: Refer a config whether escaping unicode or not in JSON
cosmo0920 Jul 31, 2025
86f4e4a
out_nrlogs: Refer a config whether escaping unicode or not in JSON
cosmo0920 Jul 31, 2025
9656e32
out_null: Refer a config whether escaping unicode or not in JSON
cosmo0920 Jul 31, 2025
f86c497
out_opensearch: Refer a config whether escaping unicode or not in JSON
cosmo0920 Jul 31, 2025
d88019d
out_oracle_log_ayalysis: Refer a config whether escaping unicode or n…
cosmo0920 Jul 31, 2025
6774067
out_s3: Refer a config whether escaping unicode or not in JSON
cosmo0920 Jul 31, 2025
c114453
out_skywalking: Refer a config whether escaping unicode or not in JSON
cosmo0920 Jul 31, 2025
0114c3d
out_slack: Refer a config whether escaping unicode or not in JSON
cosmo0920 Jul 31, 2025
a93036c
out_splunk: Refer a config whether escaping or not in JSON
cosmo0920 Jul 31, 2025
4496b27
out_stackdriver: Refer a config whether escaping unicode or not in JSON
cosmo0920 Jul 31, 2025
ff5c9c5
out_stdout: Refer a config whether escaping unicode or not in JSON
cosmo0920 Jul 31, 2025
a61f096
out_tcp: Refer a config whether escaping unicode or not in JSON
cosmo0920 Jul 31, 2025
2e027b7
out_udp: Refer a config whether escaping unicode or not in JSON
cosmo0920 Jul 31, 2025
a105cee
out_vivo: Refer a config whether escaping unicode or not in JSON
cosmo0920 Jul 31, 2025
5259021
out_websocket: Refer a config whether escaping unicode or not in JSON
cosmo0920 Jul 31, 2025
838aab3
processor_content_modifier: Follow the argument increase
cosmo0920 Jul 31, 2025
3b58061
tests: log_event_decoder: Follow an increase of argument
cosmo0920 Jul 31, 2025
bc185e6
tests: mp: Follow an increase of argument
cosmo0920 Jul 31, 2025
f37d644
tests: msgpack_append_message: Follow an increase of argument
cosmo0920 Jul 31, 2025
d08d6d6
tests: opnentelemetry: Follow an increase of argument
cosmo0920 Jul 31, 2025
da2fd8a
tests: pack: Follow an increase of argument
cosmo0920 Jul 31, 2025
2f377ab
tests: stream_processor: Follow an increase of argument
cosmo0920 Jul 31, 2025
f96fb0d
tests: filter_lua: Follow an increase of argument
cosmo0920 Jul 31, 2025
cef6c8e
tests: in_opentelemetry: Follow an increase of argument
cosmo0920 Jul 31, 2025
b4b06af
utils: Optimize raw string function with SIMD
cosmo0920 Jul 31, 2025
02a902b
tests: utils: Add test case for encoding raw UTF-8 strings
cosmo0920 Jul 31, 2025
1336593
in_systemd: Follow an increase of argument
cosmo0920 Jul 31, 2025
49733c2
pack: Avoid to use hard-coded value for escaping strings
cosmo0920 Jul 31, 2025
b0f40da
out_pqsql: Follow an increase of argument
cosmo0920 Jul 31, 2025
3cbe15f
tests: fuzzer: Follow an increase of argument
cosmo0920 Jul 31, 2025
6f767a8
tests: fuzzer: Follow an increase of argument
cosmo0920 Jul 31, 2025
5ede613
tests: fuzzer: Follow an increase of argument
cosmo0920 Jul 31, 2025
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: 5 additions & 0 deletions include/fluent-bit/flb_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,8 @@ struct flb_config {
struct flb_task_map *task_map;
size_t task_map_size;

int json_escape_unicode;

int dry_run;
};

Expand Down Expand Up @@ -412,4 +414,7 @@ enum conf_type {
#define FLB_CONF_STR_SCHED_CAP "scheduler.cap"
#define FLB_CONF_STR_SCHED_BASE "scheduler.base"

/* json escape */
#define FLB_CONF_UNICODE_STR_JSON_ESCAPE "json.escape_unicode"

#endif
10 changes: 6 additions & 4 deletions include/fluent-bit/flb_pack.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,17 @@ int flb_pack_json_valid(const char *json, size_t len);

flb_sds_t flb_pack_msgpack_to_json_format(const char *data, uint64_t bytes,
int json_format, int date_format,
flb_sds_t date_key);
flb_sds_t date_key, int escape_unicode);
int flb_pack_to_json_format_type(const char *str);
int flb_pack_to_json_date_type(const char *str);

void flb_pack_print(const char *data, size_t bytes);
int flb_msgpack_to_json(char *json_str, size_t str_len,
const msgpack_object *obj);
char* flb_msgpack_to_json_str(size_t size, const msgpack_object *obj);
flb_sds_t flb_msgpack_raw_to_json_sds(const void *in_buf, size_t in_size);
const msgpack_object *obj,
int escape_unicode);
char* flb_msgpack_to_json_str(size_t size, const msgpack_object *obj,
int escape_unicode);
flb_sds_t flb_msgpack_raw_to_json_sds(const void *in_buf, size_t in_size, int escape_unicode);

int flb_pack_time_now(msgpack_packer *pck);
int flb_msgpack_expand_map(char *map_data, size_t map_size,
Expand Down
4 changes: 2 additions & 2 deletions include/fluent-bit/flb_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ void flb_utils_bytes_to_human_readable_size(size_t bytes,
char *out_buf, size_t size);
int flb_utils_time_split(const char *time, int *sec, long *nsec);
int flb_utils_write_str(char *buf, int *off, size_t size,
const char *str, size_t str_len);
const char *str, size_t str_len, int escape_unicode);
int flb_utils_write_str_buf(const char *str, size_t str_len,
char **out, size_t *out_size);
char **out, size_t *out_size, int escape_unicode);

int flb_utils_url_split(const char *in_url, char **out_protocol,
char **out_host, char **out_port, char **out_uri);
Expand Down
20 changes: 10 additions & 10 deletions plugins/filter_expect/expect.c
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ static char *ra_value_type_to_str(struct flb_ra_value *val)
return "UNKNOWN";
}

static int rule_apply(struct flb_expect *ctx, msgpack_object map)
static int rule_apply(struct flb_expect *ctx, msgpack_object map, struct flb_config *config)
{
int n = 0;
char *json;
Expand All @@ -292,7 +292,7 @@ static int rule_apply(struct flb_expect *ctx, msgpack_object map)
continue;
}

json = flb_msgpack_to_json_str(size, &map);
json = flb_msgpack_to_json_str(size, &map, config->json_escape_unicode);
flb_plg_error(ctx->ins,
"exception on rule #%i 'key_exists', key '%s' "
"not found. Record content:\n%s",
Expand All @@ -305,7 +305,7 @@ static int rule_apply(struct flb_expect *ctx, msgpack_object map)
n++;
continue;
}
json = flb_msgpack_to_json_str(size, &map);
json = flb_msgpack_to_json_str(size, &map, config->json_escape_unicode);
flb_plg_error(ctx->ins,
"exception on rule #%i 'key_not_exists', key '%s' "
"exists. Record content:\n%s",
Expand All @@ -316,7 +316,7 @@ static int rule_apply(struct flb_expect *ctx, msgpack_object map)
}
else if (rule->type == FLB_EXP_KEY_VAL_NULL) {
if (!val) {
json = flb_msgpack_to_json_str(size, &map);
json = flb_msgpack_to_json_str(size, &map, config->json_escape_unicode);
flb_plg_error(ctx->ins,
"exception on rule #%i 'key_val_is_null', "
"key '%s' not found. Record content:\n%s",
Expand All @@ -325,7 +325,7 @@ static int rule_apply(struct flb_expect *ctx, msgpack_object map)
return FLB_FALSE;
}
if (val->type != FLB_RA_NULL) {
json = flb_msgpack_to_json_str(size, &map);
json = flb_msgpack_to_json_str(size, &map, config->json_escape_unicode);
flb_plg_error(ctx->ins,
"exception on rule #%i 'key_val_is_null', "
"key '%s' contains a value type '%s'. "
Expand All @@ -340,7 +340,7 @@ static int rule_apply(struct flb_expect *ctx, msgpack_object map)
}
else if (rule->type == FLB_EXP_KEY_VAL_NOT_NULL) {
if (!val) {
json = flb_msgpack_to_json_str(size, &map);
json = flb_msgpack_to_json_str(size, &map, config->json_escape_unicode);
flb_plg_error(ctx->ins,
"exception on rule #%i 'key_val_is_not_null', "
"key '%s' not found. Record content:\n%s",
Expand All @@ -349,7 +349,7 @@ static int rule_apply(struct flb_expect *ctx, msgpack_object map)
return FLB_FALSE;
}
if (val->type == FLB_RA_NULL) {
json = flb_msgpack_to_json_str(size, &map);
json = flb_msgpack_to_json_str(size, &map, config->json_escape_unicode);
flb_plg_error(ctx->ins,
"exception on rule #%i 'key_val_is_not_null', "
"key '%s' contains a value type '%s'. "
Expand All @@ -364,7 +364,7 @@ static int rule_apply(struct flb_expect *ctx, msgpack_object map)
}
else if (rule->type == FLB_EXP_KEY_VAL_EQ) {
if (!val) {
json = flb_msgpack_to_json_str(size, &map);
json = flb_msgpack_to_json_str(size, &map, config->json_escape_unicode);
flb_plg_error(ctx->ins,
"exception on rule #%i 'key_val_is_null', "
"key '%s' not found. Record content:\n%s",
Expand All @@ -376,7 +376,7 @@ static int rule_apply(struct flb_expect *ctx, msgpack_object map)
if (val->type == FLB_RA_STRING) {
if (flb_sds_cmp(val->val.string, rule->expect,
flb_sds_len(rule->expect)) != 0) {
json = flb_msgpack_to_json_str(size, &map);
json = flb_msgpack_to_json_str(size, &map, config->json_escape_unicode);
flb_plg_error(ctx->ins,
"exception on rule #%i 'key_val_eq', "
"key value '%s' is different than "
Expand Down Expand Up @@ -430,7 +430,7 @@ static int cb_expect_filter(const void *data, size_t bytes,
while ((ret = flb_log_event_decoder_next(
&log_decoder,
&log_event)) == FLB_EVENT_DECODER_SUCCESS) {
ret = rule_apply(ctx, *log_event.body);
ret = rule_apply(ctx, *log_event.body, config);
if (ret == FLB_TRUE) {
/* rule matches, we are good */
continue;
Expand Down
4 changes: 2 additions & 2 deletions plugins/filter_nightfall/nightfall_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,8 @@ static flb_sds_t build_request_body(struct flb_filter_nightfall *ctx,
msgpack_pack_str_with_body(&req_pk, "policyUUIDs", 11);
msgpack_pack_array(&req_pk, 1);
msgpack_pack_str_with_body(&req_pk, ctx->policy_id, 36);
request_body = flb_msgpack_raw_to_json_sds(req_sbuf.data, req_sbuf.size);

request_body = flb_msgpack_raw_to_json_sds(req_sbuf.data, req_sbuf.size, FLB_TRUE);

msgpack_sbuffer_destroy(&req_sbuf);
flb_sds_destroy(num_str);
Expand Down
2 changes: 1 addition & 1 deletion plugins/filter_wasm/filter_wasm.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ static int cb_wasm_filter(const void *data, size_t bytes,
switch(ctx->event_format) {
case FLB_FILTER_WASM_FMT_JSON:
/* Encode as JSON from msgpack */
buf = flb_msgpack_to_json_str(alloc_size, log_event.body);
buf = flb_msgpack_to_json_str(alloc_size, log_event.body, config->json_escape_unicode);

if (buf) {
/* Execute WASM program */
Expand Down
9 changes: 6 additions & 3 deletions plugins/out_azure/azure.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ static int cb_azure_init(struct flb_output_instance *ins,
static int azure_format(const void *in_buf, size_t in_bytes,
flb_sds_t tag, flb_sds_t *tag_val_out,
char **out_buf, size_t *out_size,
struct flb_azure *ctx)
struct flb_azure *ctx,
struct flb_config *config)
{
int i;
int array_size = 0;
Expand Down Expand Up @@ -160,7 +161,8 @@ static int azure_format(const void *in_buf, size_t in_bytes,
msgpack_sbuffer_destroy(&tmp_sbuf);
}

record = flb_msgpack_raw_to_json_sds(mp_sbuf.data, mp_sbuf.size);
record = flb_msgpack_raw_to_json_sds(mp_sbuf.data, mp_sbuf.size,
config->json_escape_unicode);
if (!record) {
flb_errno();

Expand Down Expand Up @@ -317,7 +319,8 @@ static void cb_azure_flush(struct flb_event_chunk *event_chunk,

/* Convert binary logs into a JSON payload */
ret = azure_format(event_chunk->data, event_chunk->size,
event_chunk->tag, &final_log_type, &buf_data, &buf_size, ctx);
event_chunk->tag, &final_log_type, &buf_data, &buf_size, ctx,
config);
/* If cannot get matching record using log_type_prefix, use log_type directly */
if (!final_log_type) {
final_log_type = ctx->log_type;
Expand Down
3 changes: 2 additions & 1 deletion plugins/out_azure_blob/azure_blob.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ static int azure_blob_format(struct flb_config *config,
out_buf = flb_pack_msgpack_to_json_format(data, bytes,
FLB_PACK_JSON_FORMAT_LINES,
FLB_PACK_JSON_DATE_ISO8601,
ctx->date_key);
ctx->date_key,
config->json_escape_unicode);
if (!out_buf) {
return -1;
}
Expand Down
12 changes: 8 additions & 4 deletions plugins/out_azure_kusto/azure_kusto.c
Original file line number Diff line number Diff line change
Expand Up @@ -957,7 +957,8 @@ static int cb_azure_kusto_init(struct flb_output_instance *ins, struct flb_confi
*/
static int azure_kusto_format(struct flb_azure_kusto *ctx, const char *tag, int tag_len,
const void *data, size_t bytes, void **out_data,
size_t *out_size)
size_t *out_size,
struct flb_config *config)
{
int index;
int records = 0;
Expand Down Expand Up @@ -1064,7 +1065,8 @@ static int azure_kusto_format(struct flb_azure_kusto *ctx, const char *tag, int
msgpack_pack_str_body(&mp_pck, "log_attribute_missing", 20);
}

flb_sds_t json_record = flb_msgpack_raw_to_json_sds(mp_sbuf.data, mp_sbuf.size);
flb_sds_t json_record = flb_msgpack_raw_to_json_sds(mp_sbuf.data, mp_sbuf.size,
config->json_escape_unicode);
if (!json_record) {
flb_plg_error(ctx->ins, "error converting msgpack to JSON");
flb_sds_destroy(out_buf);
Expand Down Expand Up @@ -1234,7 +1236,8 @@ static void cb_azure_kusto_flush(struct flb_event_chunk *event_chunk,

/* Reformat msgpack to JSON payload */
ret = azure_kusto_format(ctx, tag_name, tag_name_len, event_chunk->data,
event_chunk->size, (void **)&json, &json_size);
event_chunk->size, (void **)&json, &json_size,
config);
if (ret != 0) {
flb_plg_error(ctx->ins, "cannot reformat data into json");
ret = FLB_RETRY;
Expand Down Expand Up @@ -1345,7 +1348,8 @@ static void cb_azure_kusto_flush(struct flb_event_chunk *event_chunk,

/* Reformat msgpack data to JSON payload */
ret = azure_kusto_format(ctx, event_chunk->tag, tag_len, event_chunk->data,
event_chunk->size, (void **)&json, &json_size);
event_chunk->size, (void **)&json, &json_size,
config);
if (ret != 0) {
flb_plg_error(ctx->ins, "cannot reformat data into json");
ret = FLB_RETRY;
Expand Down
9 changes: 6 additions & 3 deletions plugins/out_azure_logs_ingestion/azure_logs_ingestion.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ static int cb_azure_logs_ingestion_init(struct flb_output_instance *ins,
allocates sds string */
static int az_li_format(const void *in_buf, size_t in_bytes,
char **out_buf, size_t *out_size,
struct flb_az_li *ctx)
struct flb_az_li *ctx,
struct flb_config *config)
{
int i;
int array_size = 0;
Expand Down Expand Up @@ -141,7 +142,8 @@ static int az_li_format(const void *in_buf, size_t in_bytes,
msgpack_sbuffer_destroy(&tmp_sbuf);
}

record = flb_msgpack_raw_to_json_sds(mp_sbuf.data, mp_sbuf.size);
record = flb_msgpack_raw_to_json_sds(mp_sbuf.data, mp_sbuf.size,
config->json_escape_unicode);
if (!record) {
flb_errno();
msgpack_sbuffer_destroy(&mp_sbuf);
Expand Down Expand Up @@ -266,7 +268,8 @@ static void cb_azure_logs_ingestion_flush(struct flb_event_chunk *event_chunk,

/* Convert binary logs into a JSON payload */
ret = az_li_format(event_chunk->data, event_chunk->size,
&json_payload, &json_payload_size, ctx);
&json_payload, &json_payload_size, ctx,
config);
if (ret == -1) {
flb_upstream_conn_release(u_conn);
FLB_OUTPUT_RETURN(FLB_ERROR);
Expand Down
8 changes: 5 additions & 3 deletions plugins/out_bigquery/bigquery.c
Original file line number Diff line number Diff line change
Expand Up @@ -847,7 +847,8 @@ static int cb_bigquery_init(struct flb_output_instance *ins,
static int bigquery_format(const void *data, size_t bytes,
const char *tag, size_t tag_len,
char **out_data, size_t *out_size,
struct flb_bigquery *ctx)
struct flb_bigquery *ctx,
struct flb_config *config)
{
int array_size = 0;
flb_sds_t out_buf;
Expand Down Expand Up @@ -937,7 +938,8 @@ static int bigquery_format(const void *data, size_t bytes,
}

/* Convert from msgpack to JSON */
out_buf = flb_msgpack_raw_to_json_sds(mp_sbuf.data, mp_sbuf.size);
out_buf = flb_msgpack_raw_to_json_sds(mp_sbuf.data, mp_sbuf.size,
config->json_escape_unicode);

Comment on lines +941 to 943
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Missing NULL-check before dereferencing config

config is assumed non-NULL when accessing config->json_escape_unicode. The engine passes a valid pointer in normal paths, but defensive code would make the function robust to accidental NULLs or future refactors.

-    out_buf = flb_msgpack_raw_to_json_sds(mp_sbuf.data, mp_sbuf.size,
-                                          config->json_escape_unicode);
+    if (!config) {
+        flb_plg_error(ctx->ins, "NULL config passed to bigquery_format()");
+        return -1;
+    }
+    out_buf = flb_msgpack_raw_to_json_sds(mp_sbuf.data, mp_sbuf.size,
+                                          config->json_escape_unicode);

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In plugins/out_bigquery/bigquery.c around lines 941 to 943, the code
dereferences the config pointer without checking if it is NULL, which can cause
crashes if config is NULL. Add a NULL check for config before accessing
config->json_escape_unicode, and handle the NULL case appropriately, such as
using a default value or returning an error, to make the function more robust.

flb_log_event_decoder_destroy(&log_decoder);
msgpack_sbuffer_destroy(&mp_sbuf);
Expand Down Expand Up @@ -996,7 +998,7 @@ static void cb_bigquery_flush(struct flb_event_chunk *event_chunk,
/* Reformat msgpack to bigquery JSON payload */
ret = bigquery_format(event_chunk->data, event_chunk->size,
event_chunk->tag, flb_sds_len(event_chunk->tag),
&payload_buf, &payload_size, ctx);
&payload_buf, &payload_size, ctx, config);
if (ret != 0) {
flb_upstream_conn_release(u_conn);
flb_sds_destroy(token);
Expand Down
7 changes: 4 additions & 3 deletions plugins/out_calyptia/calyptia.c
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ static flb_sds_t get_agent_metadata(struct flb_calyptia *ctx)
flb_mp_map_header_end(&mh);

/* convert to json */
meta = flb_msgpack_raw_to_json_sds(mp_sbuf.data, mp_sbuf.size);
meta = flb_msgpack_raw_to_json_sds(mp_sbuf.data, mp_sbuf.size, FLB_TRUE); /* could be ASCII */
msgpack_sbuffer_destroy(&mp_sbuf);

return meta;
Expand Down Expand Up @@ -532,7 +532,7 @@ static int store_session_get(struct flb_calyptia *ctx,
}

/* decode */
json = flb_msgpack_raw_to_json_sds(buf, size);
json = flb_msgpack_raw_to_json_sds(buf, size, FLB_TRUE); /* TODO: could be ASCII? */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we resolve this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure but the current pattern of usages do not have multibytes between the dedicated service and this plugin.

flb_free(buf);
if (!json) {
return -1;
Expand Down Expand Up @@ -1029,7 +1029,8 @@ static void cb_calyptia_flush(struct flb_event_chunk *event_chunk,
event_chunk->size,
FLB_PACK_JSON_FORMAT_STREAM,
FLB_PACK_JSON_DATE_DOUBLE,
NULL);
NULL,
FLB_TRUE); /* Trace is ASCII */
if (json == NULL) {
flb_upstream_conn_release(u_conn);
FLB_OUTPUT_RETURN(FLB_RETRY);
Expand Down
Loading
Loading