TSG-21787 Proxy初始化kafka topic时增加client.id参数

TSG-21730 Proxy优化Manipulation日志中host和fqdn字段的格式
This commit is contained in:
fengweihao
2024-07-12 11:13:56 +08:00
parent 5eccfbb882
commit 88a7a8c5c4
7 changed files with 101 additions and 188 deletions

View File

@@ -175,6 +175,17 @@ static int get_ip_server_geolocation(struct tfe_cmsg * cmsg, cJSON *per_hit_obj)
return 0;
}
int proxy_add_host_to_object(cJSON *common_obj, const char *req_spec_host)
{
unsigned int port;
char *format_host=ALLOC(char, strlen(req_spec_host)+1);
sscanf(req_spec_host, "%[^:]:%u", format_host, &port);
cJSON_AddStringToObject(common_obj, "http_host", format_host);
cJSON_AddStringToObject(common_obj, "server_fqdn", format_host);
FREE(&format_host);
return 0;
}
int proxy_send_log(struct proxy_logger* handle, const struct proxy_log* log_msg)
{
const struct tfe_http_session* http=log_msg->http;
@@ -300,8 +311,7 @@ int proxy_send_log(struct proxy_logger* handle, const struct proxy_log* log_msg)
cJSON_AddNumberToObject(common_obj, "sent_bytes", c2s_byte_num);
cJSON_AddNumberToObject(common_obj, "received_bytes", s2c_byte_num);
cJSON_AddStringToObject(common_obj, "http_url", http->req->req_spec.url);
cJSON_AddStringToObject(common_obj, "http_host", http->req->req_spec.host);
cJSON_AddStringToObject(common_obj, "server_fqdn", http->req->req_spec.host);
proxy_add_host_to_object(common_obj, http->req->req_spec.host);
if(handle->effective_device_tag)
{