TSG-376 修复Proxy Event Logs中Request Line、Response Line显示为空,Stream Trace Id显示为0

1)修复重定向命中URL+请求头,域名输入错误页面本身重定向失败问题
This commit is contained in:
fengweihao
2019-12-05 19:04:04 +08:00
parent 70da622393
commit 7476f84fa1
3 changed files with 32 additions and 11 deletions

View File

@@ -214,18 +214,35 @@ int pangu_send_log(struct pangu_logger* handle, const struct pangu_log* log_msg)
cJSON_AddStringToObject(common_obj, "http_version", app_proto[http->major_version]);
cJSON_AddStringToObject(common_obj, "common_schema_type", "HTTP");
uint64_t opt_val;
uint16_t opt_out_size;
char opt_val[24]; uint16_t opt_out_size;
struct tfe_cmsg * cmsg = tfe_stream_get0_cmsg(log_msg->stream);
if (cmsg!=NULL)
{
int ret=tfe_cmsg_get_value(cmsg, TFE_CMSG_STREAM_TRACE_ID, (unsigned char *) &opt_val, sizeof(opt_val), &opt_out_size);
int ret=tfe_cmsg_get_value(cmsg, TFE_CMSG_STREAM_TRACE_ID, (unsigned char *) opt_val, sizeof(opt_val), &opt_out_size);
if (ret==0)
{
cJSON_AddNumberToObject(common_obj, "common_stream_trace_id", opt_val);
cJSON_AddStringToObject(common_obj, "common_stream_trace_id", opt_val);
}
}
if (http->req)
{
char *request_line=NULL;
struct tfe_http_req_spec req_spec=http->req->req_spec;
asprintf(&request_line, "%s %s HTTP/%d.%d", http_std_method_to_string(req_spec.method), req_spec.url, http->major_version, http->minor_version);
cJSON_AddStringToObject(common_obj, "http_request_line", request_line);
free(request_line);
}
if (http->resp)
{
char *response_line=NULL;
struct tfe_http_resp_spec resp_spec=http->resp->resp_spec;
asprintf(&response_line, "HTTP/%d.%d %d OK", http->major_version, http->minor_version, resp_spec.resp_code);
cJSON_AddStringToObject(common_obj, "http_response_line", response_line);
free(response_line);
}
switch(addr->addrtype)
{
case TFE_ADDR_STREAM_TUPLE4_V4: