TSG-1167 proxy-event-log增加注入文件大小

This commit is contained in:
fengweihao
2020-04-03 16:16:07 +08:00
parent c94eab176b
commit ab492252a9
4 changed files with 8 additions and 1 deletions

View File

@@ -1041,6 +1041,7 @@ struct pangu_http_ctx
struct policy_action_param *param;
struct evbuffer* log_req_body, *log_resp_body;
size_t inject_sz;
struct replace_ctx * rep_ctx;
struct insert_ctx * ins_ctx;
@@ -1696,6 +1697,7 @@ static void http_hijack(const struct tfe_http_session * session, enum tfe_http_e
ctx->action = PG_ACTION_NONE;
return;
}
ctx->inject_sz = hijack_size;
char cont_len_str[16];
@@ -1748,6 +1750,7 @@ static int format_insert_rule(int profile_id, struct insert_rule *rule)
rule->script = tfe_strdup(insert_profile->profile_msg);
rule->type = tfe_strdup(insert_profile->profile_type);
rule->position = tfe_strdup(insert_profile->profile_position);
rule->inject_sz = insert_profile->msg_len;
ma_profile_table_free(insert_profile);
insert_profile = NULL;
@@ -1787,6 +1790,7 @@ static void http_insert(const struct tfe_stream * stream, const struct tfe_http_
ctx->action = PG_ACTION_NONE;
return;
}
ctx->inject_sz = ins_ctx->rule->inject_sz;
}
else
{
@@ -2474,7 +2478,7 @@ void pangu_on_http_end(const struct tfe_stream * stream,
}
}
struct pangu_log log_msg = {.stream=stream, .http=session, .result=ctx->enforce_rules, .result_num=ctx->n_enforce,
.req_body= ctx->log_req_body, .resp_body=ctx->log_resp_body, .action=0};
.req_body=ctx->log_req_body, .resp_body=ctx->log_resp_body, .action=0, .inject_sz=ctx->inject_sz};
if(ctx->action == PG_ACTION_MANIPULATE)
{

View File

@@ -303,6 +303,7 @@ int pangu_send_log(struct pangu_logger* handle, const struct pangu_log* log_msg)
if(log_msg->result[i].action == LG_ACTION_MANIPULATE)
{
cJSON_AddStringToObject(per_hit_obj, "common_sub_action", manipulate_action_map[log_msg->action]);
cJSON_AddNumberToObject(per_hit_obj, "http_action_file_sz", log_msg->inject_sz);
}
else
{

View File

@@ -12,6 +12,7 @@ struct pangu_log
size_t result_num;
struct evbuffer* req_body, *resp_body;
unsigned char action;
size_t inject_sz;
};
struct pangu_logger;
struct pangu_logger* pangu_log_handle_create(const char* profile, const char* section, void* local_logger);

View File

@@ -23,6 +23,7 @@ struct replace_rule
struct insert_rule
{
int inject_sz;
char * script;
char * type;
char * position;