基础协议插件未识别出协议时,common_l7_protocol默认填写UNCATEGORIZED

This commit is contained in:
liuxueli
2021-05-13 18:14:07 +08:00
parent aa6ce9d578
commit 95dfbc3441
2 changed files with 9 additions and 1 deletions

View File

@@ -419,7 +419,8 @@ static int set_app_id(struct tsg_log_instance_t *_instance, struct TLD_handle_t
label=(struct gather_app_result *)project_req_get_struct(a_stream, g_tsg_para.gather_app_project_id); label=(struct gather_app_result *)project_req_get_struct(a_stream, g_tsg_para.gather_app_project_id);
if(label==NULL) if(label==NULL)
{ {
TLD_append(_handle, _instance->id2field[LOG_COMMON_L7_PROTOCOL].name, (void *)_instance->l7_unknown_name, TLD_TYPE_STRING);
return 0; return 0;
} }
@@ -428,6 +429,10 @@ static int set_app_id(struct tsg_log_instance_t *_instance, struct TLD_handle_t
{ {
TLD_append(_handle, _instance->id2field[LOG_COMMON_L7_PROTOCOL].name, (void *)protocol_list, TLD_TYPE_STRING); TLD_append(_handle, _instance->id2field[LOG_COMMON_L7_PROTOCOL].name, (void *)protocol_list, TLD_TYPE_STRING);
} }
else
{
TLD_append(_handle, _instance->id2field[LOG_COMMON_L7_PROTOCOL].name, (void *)_instance->l7_unknown_name, TLD_TYPE_STRING);
}
app_offset=0; app_offset=0;
surrogate_offset=0; surrogate_offset=0;
@@ -1064,6 +1069,8 @@ struct tsg_log_instance_t *tsg_sendlog_init(const char *conffile)
MESA_load_profile_string_def(conffile, "TSG_LOG", "LOG_PATH", _instance->log_path, sizeof(_instance->log_path), "./tsglog/tsglog"); MESA_load_profile_string_def(conffile, "TSG_LOG", "LOG_PATH", _instance->log_path, sizeof(_instance->log_path), "./tsglog/tsglog");
MESA_load_profile_int_def(conffile, "TSG_LOG", "SEND_USER_REGION",&(_instance->send_user_region), 0); MESA_load_profile_int_def(conffile, "TSG_LOG", "SEND_USER_REGION",&(_instance->send_user_region), 0);
MESA_load_profile_string_def(conffile, "TSG_LOG", "L7_UNKNOWN_NAME", _instance->l7_unknown_name, sizeof(_instance->l7_unknown_name), "UNCATEGORIZED");
_instance->logger=MESA_create_runtime_log_handle(_instance->log_path, _instance->level); _instance->logger=MESA_create_runtime_log_handle(_instance->log_path, _instance->level);
if(_instance->logger==NULL) if(_instance->logger==NULL)
{ {

View File

@@ -129,6 +129,7 @@ struct tsg_log_instance_t
int *send_log_percent; int *send_log_percent;
int *fs_status_ids; int *fs_status_ids;
struct timespec *drop_start; struct timespec *drop_start;
char l7_unknown_name[MAX_STRING_LEN];
char log_path[MAX_STRING_LEN*2]; char log_path[MAX_STRING_LEN*2];
char tcp_label[MAX_STRING_LEN]; char tcp_label[MAX_STRING_LEN];
char udp_label[MAX_STRING_LEN]; char udp_label[MAX_STRING_LEN];