summaryrefslogtreecommitdiff
path: root/plugin/business/tsg-http/src/tsg_logger.cpp
diff options
context:
space:
mode:
authorfengweihao <[email protected]>2023-04-18 17:52:24 +0800
committerfengweihao <[email protected]>2023-04-18 17:52:24 +0800
commit1430681184553defec7236b872557dbcca8de8fe (patch)
tree2893a593acdf28ce03729ede156290bcf24b6364 /plugin/business/tsg-http/src/tsg_logger.cpp
parent915dd007316b0121e4275b4b9586049795fe7d81 (diff)
TSG-14802 修复代理日志中common_service_category字段填写错误v4.8.5-20230418
Diffstat (limited to 'plugin/business/tsg-http/src/tsg_logger.cpp')
-rw-r--r--plugin/business/tsg-http/src/tsg_logger.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/plugin/business/tsg-http/src/tsg_logger.cpp b/plugin/business/tsg-http/src/tsg_logger.cpp
index e15ed4c..4c15200 100644
--- a/plugin/business/tsg-http/src/tsg_logger.cpp
+++ b/plugin/business/tsg-http/src/tsg_logger.cpp
@@ -86,7 +86,7 @@ error_out:
return NULL;
}
-static unsigned int proxy_log_get_fqdn_cat(struct tfe_cmsg *cmsg, unsigned int *category_id_val)
+static unsigned int proxy_log_get_fqdn_cat(struct tfe_cmsg *cmsg, unsigned int *category_id_val, size_t sz_out_value_buf)
{
int ret=0;
unsigned category_id_num=0;
@@ -97,7 +97,7 @@ static unsigned int proxy_log_get_fqdn_cat(struct tfe_cmsg *cmsg, unsigned int *
{
return -1;
}
- ret = tfe_cmsg_get_value(cmsg, TFE_CMSG_FQDN_CAT_ID_VAL, (unsigned char *)category_id_val, sizeof(category_id_val), &opt_out_size);
+ ret = tfe_cmsg_get_value(cmsg, TFE_CMSG_FQDN_CAT_ID_VAL, (unsigned char *)category_id_val, sz_out_value_buf, &opt_out_size);
if (ret != 0)
{
return -1;
@@ -152,7 +152,7 @@ int proxy_send_log(struct proxy_logger* handle, const struct proxy_log* log_msg)
cJSON_AddStringToObject(common_obj, "http_version", app_proto[http->major_version]);
cJSON_AddStringToObject(common_obj, "common_schema_type", "HTTP");
- unsigned int common_direction=0, category_id_val[8]={0};
+ unsigned int common_direction=0, category_id_val[64]={0};
char opt_val[24]={0}; uint16_t opt_out_size;
struct tfe_cmsg * cmsg = tfe_stream_get0_cmsg(log_msg->stream);
if (cmsg!=NULL)
@@ -167,7 +167,7 @@ int proxy_send_log(struct proxy_logger* handle, const struct proxy_log* log_msg)
{
cJSON_AddNumberToObject(common_obj, "common_direction", common_direction); //0:域内->域外,1:域外->域内,描述的是CLIENT_IP信息
}
- ret = proxy_log_get_fqdn_cat(cmsg, category_id_val);
+ ret = proxy_log_get_fqdn_cat(cmsg, category_id_val, sizeof(category_id_val));
if (ret>0)
{
cJSON_AddItemToObject(common_obj, "common_service_category", cJSON_CreateIntArray((const int*)category_id_val, ret));