summaryrefslogtreecommitdiff
path: root/plugin/business/tsg-http/src/tsg_logger.cpp
diff options
context:
space:
mode:
authorfengweihao <[email protected]>2024-01-22 14:28:07 +0800
committerfengweihao <[email protected]>2024-01-22 14:28:07 +0800
commit82d8d068d64c3be675b374132260d5405b8db9b7 (patch)
tree029fa85f1cd4087a8211ffc349718dc2272a372c /plugin/business/tsg-http/src/tsg_logger.cpp
parent589c1c28a4d00b3dc56830b136b415cd718cc9fa (diff)
TSG-18731 Proxy的Monitor动作多次命中时,发送一条日志且Proxy Rule List中包含多条Monitor策略
Diffstat (limited to 'plugin/business/tsg-http/src/tsg_logger.cpp')
-rw-r--r--plugin/business/tsg-http/src/tsg_logger.cpp29
1 files changed, 26 insertions, 3 deletions
diff --git a/plugin/business/tsg-http/src/tsg_logger.cpp b/plugin/business/tsg-http/src/tsg_logger.cpp
index 4951a42..13952ac 100644
--- a/plugin/business/tsg-http/src/tsg_logger.cpp
+++ b/plugin/business/tsg-http/src/tsg_logger.cpp
@@ -336,6 +336,17 @@ int proxy_send_log(struct proxy_logger* handle, const struct proxy_log* log_msg)
}
}
+ int j=0, enable_monit=0;
+ int monit_config_id[16]={0};
+ for(size_t i=0; i<log_msg->result_num; i++)
+ {
+ if(log_msg->result[i].action == LG_ACTION_MONIT)
+ {
+ monit_config_id[j]=log_msg->result[i].config_id;
+ j++;
+ }
+ }
+
for(size_t i=0; i<log_msg->result_num; i++)
{
TFE_LOG_DEBUG(handle->local_logger, "URL: %s, policy_id: %lld, service: %d, do_log:%d",
@@ -349,12 +360,24 @@ int proxy_send_log(struct proxy_logger* handle, const struct proxy_log* log_msg)
continue;
}
+ if(log_msg->result[i].action == LG_ACTION_MONIT && enable_monit==1)
+ {
+ continue;
+ }
+
cJSON *proxy_rule_list=NULL;
int config_id[1]={0};
-
per_hit_obj=cJSON_Duplicate(common_obj, 1);
- config_id[0]=log_msg->result[i].config_id;
- proxy_rule_list = cJSON_CreateIntArray(config_id, 1);
+ if(log_msg->result[i].action == LG_ACTION_MONIT)
+ {
+ proxy_rule_list = cJSON_CreateIntArray(monit_config_id, j);
+ enable_monit=1;
+ }
+ else
+ {
+ config_id[0]=log_msg->result[i].config_id;
+ proxy_rule_list = cJSON_CreateIntArray(config_id, 1);
+ }
cJSON_AddItemToObject(per_hit_obj, "proxy_rule_list", proxy_rule_list);
cJSON_AddNumberToObject(per_hit_obj, "vsys_id", log_msg->result[i].vsys_id);
if(log_msg->result[i].action == LG_ACTION_MANIPULATE)