TSG-7982: 新增公共日志字段common_device_tag
This commit is contained in:
@@ -97,3 +97,4 @@ STRING common_link_info_c2s 84
|
|||||||
STRING common_link_info_s2c 85
|
STRING common_link_info_s2c 85
|
||||||
STRING quic_version 86
|
STRING quic_version 86
|
||||||
STRING quic_user_agent 87
|
STRING quic_user_agent 87
|
||||||
|
STRING common_device_tag 88
|
||||||
@@ -250,6 +250,7 @@ typedef struct tsg_para
|
|||||||
char log_path[MAX_DOMAIN_LEN/8];
|
char log_path[MAX_DOMAIN_LEN/8];
|
||||||
char device_id_command[MAX_DOMAIN_LEN/8];
|
char device_id_command[MAX_DOMAIN_LEN/8];
|
||||||
char data_center[_MAX_TABLE_NAME_LEN];
|
char data_center[_MAX_TABLE_NAME_LEN];
|
||||||
|
char device_tag[MAX_DOMAIN_LEN/2];
|
||||||
char table_name[TABLE_MAX][_MAX_TABLE_NAME_LEN];
|
char table_name[TABLE_MAX][_MAX_TABLE_NAME_LEN];
|
||||||
void *logger;
|
void *logger;
|
||||||
void *maat_logger;
|
void *maat_logger;
|
||||||
|
|||||||
@@ -1391,6 +1391,11 @@ static Maat_feather_t init_maat_feather(const char* conffile, char* instance_nam
|
|||||||
{
|
{
|
||||||
MESA_load_profile_string_def(conffile, "MAAT", "ACCEPT_TAGS", effective_flag, sizeof(effective_flag),"");
|
MESA_load_profile_string_def(conffile, "MAAT", "ACCEPT_TAGS", effective_flag, sizeof(effective_flag),"");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(strlen(g_tsg_para.device_tag)==0 && strlen(effective_flag)>0)
|
||||||
|
{
|
||||||
|
memcpy(g_tsg_para.device_tag, effective_flag, MIN(strlen(effective_flag), sizeof(g_tsg_para.device_tag)-1));
|
||||||
|
}
|
||||||
|
|
||||||
if(strlen(g_tsg_para.data_center)==0 && strlen(effective_flag)>0)
|
if(strlen(g_tsg_para.data_center)==0 && strlen(effective_flag)>0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1376,6 +1376,7 @@ struct tsg_log_instance_t *tsg_sendlog_init(const char *conffile)
|
|||||||
MESA_load_profile_int_def(conffile, "TSG_LOG", "LOG_LEVEL",&(_instance->level), 30);
|
MESA_load_profile_int_def(conffile, "TSG_LOG", "LOG_LEVEL",&(_instance->level), 30);
|
||||||
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_int_def(conffile, "TSG_LOG", "SEND_DATA_CENTER_SWITCH", &(_instance->send_data_center), 0);
|
||||||
|
|
||||||
MESA_load_profile_int_def(conffile, "TSG_LOG", "APP_ID_TYPE", &(_instance->app_id_type), 1); //0: int, 1: string
|
MESA_load_profile_int_def(conffile, "TSG_LOG", "APP_ID_TYPE", &(_instance->app_id_type), 1); //0: int, 1: string
|
||||||
MESA_load_profile_string_def(conffile, "TSG_LOG", "L7_UNKNOWN_NAME", _instance->l7_unknown_name, sizeof(_instance->l7_unknown_name), "UNCATEGORIZED");
|
MESA_load_profile_string_def(conffile, "TSG_LOG", "L7_UNKNOWN_NAME", _instance->l7_unknown_name, sizeof(_instance->l7_unknown_name), "UNCATEGORIZED");
|
||||||
@@ -1537,11 +1538,16 @@ int tsg_send_log(struct tsg_log_instance_t *instance, struct TLD_handle_t *handl
|
|||||||
TLD_append(_handle, _instance->id2field[LOG_COMMON_DEVICE_ID].name, (void *)(g_tsg_para.device_sn), TLD_TYPE_STRING);
|
TLD_append(_handle, _instance->id2field[LOG_COMMON_DEVICE_ID].name, (void *)(g_tsg_para.device_sn), TLD_TYPE_STRING);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(strlen(g_tsg_para.data_center)>0)
|
if(strlen(g_tsg_para.data_center)>0 && _instance->send_data_center==1)
|
||||||
{
|
{
|
||||||
TLD_append(_handle, _instance->id2field[LOG_COMMON_DATA_CENTER].name, (void *)(g_tsg_para.data_center), TLD_TYPE_STRING);
|
TLD_append(_handle, _instance->id2field[LOG_COMMON_DATA_CENTER].name, (void *)(g_tsg_para.data_center), TLD_TYPE_STRING);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(strlen(g_tsg_para.device_tag)>0)
|
||||||
|
{
|
||||||
|
TLD_append(_handle, _instance->id2field[LOG_COMMON_DEVICE_TAG].name, (void *)(g_tsg_para.device_tag), TLD_TYPE_STRING);
|
||||||
|
}
|
||||||
|
|
||||||
for(i=0;i<log_msg->result_num; i++)
|
for(i=0;i<log_msg->result_num; i++)
|
||||||
{
|
{
|
||||||
if(is_multi_hit_same_policy(&(log_msg->result[i]), policy_id, &repeat_cnt))
|
if(is_multi_hit_same_policy(&(log_msg->result[i]), policy_id, &repeat_cnt))
|
||||||
|
|||||||
@@ -113,6 +113,7 @@ typedef enum _tsg_log_field_id
|
|||||||
LOG_COMMON_LINK_INFO_S2C,
|
LOG_COMMON_LINK_INFO_S2C,
|
||||||
LOG_QUIC_VERSION,
|
LOG_QUIC_VERSION,
|
||||||
LOG_QUIC_USER_AGENT,
|
LOG_QUIC_USER_AGENT,
|
||||||
|
LOG_COMMON_DEVICE_TAG,
|
||||||
LOG_COMMON_MAX
|
LOG_COMMON_MAX
|
||||||
}tsg_log_field_id_t;
|
}tsg_log_field_id_t;
|
||||||
|
|
||||||
@@ -130,6 +131,7 @@ struct tsg_log_instance_t
|
|||||||
int max_service;
|
int max_service;
|
||||||
int app_id_type;
|
int app_id_type;
|
||||||
int send_user_region;
|
int send_user_region;
|
||||||
|
int send_data_center;
|
||||||
int recovery_interval;
|
int recovery_interval;
|
||||||
int session_attribute_project_id;
|
int session_attribute_project_id;
|
||||||
int tcp_flow_project_id;
|
int tcp_flow_project_id;
|
||||||
|
|||||||
Reference in New Issue
Block a user