From 9163b655bb740dea570f05881023f20c278d2a1a Mon Sep 17 00:00:00 2001 From: liuxueli Date: Mon, 6 Jun 2022 14:45:32 +0800 Subject: [PATCH] =?UTF-8?q?TSG-10769:=20=E4=B8=80=E4=B8=AA=E9=93=BE?= =?UTF-8?q?=E6=8E=A5=E5=91=BD=E4=B8=AD=E5=A4=9A=E4=B8=AAmonitor=E7=AD=96?= =?UTF-8?q?=E7=95=A5=EF=BC=8C=E6=94=AF=E6=8C=81=E9=80=9A=E7=9F=A5=E5=A4=9A?= =?UTF-8?q?=E4=B8=AA=E6=95=B0=E6=8D=AE=E5=8C=85=E5=AD=98=E5=82=A8=E8=B7=AF?= =?UTF-8?q?=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- inc/tsg_label.h | 9 ++++++++- src/tsg_send_log.cpp | 15 ++++++++++----- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/inc/tsg_label.h b/inc/tsg_label.h index 11e4a35..6ce52cd 100644 --- a/inc/tsg_label.h +++ b/inc/tsg_label.h @@ -135,6 +135,12 @@ struct mirrored_stat int compile_id; }; +struct policy_capture_result +{ + int compile_id; + char *packet_path; +}; + struct tsg_notify_data { int compile_id; @@ -149,7 +155,8 @@ struct tsg_notify_data struct tsg_notify_execution_result { int stat_mirrored_cnt; - char *capture_packet_path; + int capture_result_cnt; + struct policy_capture_result capture_result[MAX_RESULT_NUM]; struct mirrored_stat stat_mirrored[MAX_RESULT_NUM]; }; diff --git a/src/tsg_send_log.cpp b/src/tsg_send_log.cpp index 52120f3..f1ccaa2 100644 --- a/src/tsg_send_log.cpp +++ b/src/tsg_send_log.cpp @@ -1512,23 +1512,28 @@ int set_notify_execution_result(struct tsg_log_instance_t *_instance, struct TLD { return 0; } + + TLD_delete(_handle, _instance->id2field[LOG_COMMON_MIRRORED_PKTS].name); + TLD_delete(_handle, _instance->id2field[LOG_COMMON_MIRRORED_BYTES].name); + TLD_delete(_handle, _instance->id2field[LOG_COMMON_PACKET_CAPTURE_FILE].name); for(i=0; istat_mirrored_cnt; i++) { if(execution_result->stat_mirrored[i].compile_id==p_result->config_id) { - TLD_delete(_handle, _instance->id2field[LOG_COMMON_MIRRORED_PKTS].name); - TLD_delete(_handle, _instance->id2field[LOG_COMMON_MIRRORED_BYTES].name); TLD_append(_handle, _instance->id2field[LOG_COMMON_MIRRORED_PKTS].name, (void *)(execution_result->stat_mirrored[i].packets), TLD_TYPE_LONG); TLD_append(_handle, _instance->id2field[LOG_COMMON_MIRRORED_BYTES].name, (void *)(execution_result->stat_mirrored[i].bytes), TLD_TYPE_LONG); break; } } - if(execution_result->capture_packet_path!=NULL) + for(i=0; icapture_result_cnt; i++) { - TLD_delete(_handle, _instance->id2field[LOG_COMMON_PACKET_CAPTURE_FILE].name); - TLD_append(_handle, _instance->id2field[LOG_COMMON_PACKET_CAPTURE_FILE].name, (void *)(execution_result->capture_packet_path), TLD_TYPE_STRING); + if(execution_result->capture_result[i].compile_id==p_result->config_id) + { + TLD_append(_handle, _instance->id2field[LOG_COMMON_PACKET_CAPTURE_FILE].name, (void *)(execution_result->capture_result[i].packet_path), TLD_TYPE_STRING); + break; + } } return 1;