diff --git a/src/tsg_entry.h b/src/tsg_entry.h index 3a6dfdc..cb55c34 100644 --- a/src/tsg_entry.h +++ b/src/tsg_entry.h @@ -406,6 +406,8 @@ const void *get_struct_project(const struct streaminfo *a_stream, int project_id //parent_app_name.app_name int tsg_app_id2name(int app_id, char *app_name, int app_name_len, int is_joint_parent); +//return 18 or 19: subdivision_addr +int tsg_get_location_type(void); void location_free_data(int table_id, MAAT_PLUGIN_EX_DATA* ad, long argl, void* argp); void ASN_number_free(int table_id, MAAT_PLUGIN_EX_DATA* ad, long argl, void* argp); void subscriber_id_free(int table_id, MAAT_PLUGIN_EX_DATA* ad, long argl, void* argp); diff --git a/src/tsg_rule.cpp b/src/tsg_rule.cpp index f0989ee..23acd97 100644 --- a/src/tsg_rule.cpp +++ b/src/tsg_rule.cpp @@ -2930,3 +2930,8 @@ int tsg_set_fqdn_category_id(const struct streaminfo *a_stream, unsigned int *ca return 0; } + +int tsg_get_location_type(void) +{ + return g_tsg_para.location_field_num; +} diff --git a/src/tsg_send_log.cpp b/src/tsg_send_log.cpp index 231b83a..efc62db 100644 --- a/src/tsg_send_log.cpp +++ b/src/tsg_send_log.cpp @@ -348,16 +348,31 @@ static int set_location(struct TLD_handle_t *_handle, struct streaminfo *a_strea return 0; } - len+=string_cat(buff+len, buff_len-len, location_info->country_full); - buff[len++]='.'; - len+=string_cat(buff+len, buff_len-len, location_info->province_full); - buff[len++]='.'; - len+=string_cat(buff+len, buff_len-len, location_info->city_full); - - if(location_info->subdivision_addr!=NULL) + int location_type=tsg_get_location_type(); + switch(location_type) { - buff[len++]='.'; - len+=string_cat(buff+len, buff_len-len, location_info->subdivision_addr); + case 18: + len+=string_cat(buff+len, buff_len-len, location_info->city_full); + buff[len++]=','; + len+=string_cat(buff+len, buff_len-len, location_info->province_full); + buff[len++]=','; + len+=string_cat(buff+len, buff_len-len, location_info->country_full); + break; + case 19: + len+=string_cat(buff+len, buff_len-len, location_info->country_full); + buff[len++]='.'; + len+=string_cat(buff+len, buff_len-len, location_info->province_full); + buff[len++]='.'; + len+=string_cat(buff+len, buff_len-len, location_info->city_full); + + if(location_info->subdivision_addr!=NULL) + { + buff[len++]='.'; + len+=string_cat(buff+len, buff_len-len, location_info->subdivision_addr); + } + break; + default: + return 0; } TLD_append(_handle, field_name, (void *)buff, TLD_TYPE_STRING); @@ -2074,8 +2089,21 @@ int tsg_send_payload(struct tsg_log_instance_t *instance, int topic_id, char *pa ); return -1; } + else + { + update_percent(_instance, topic_id, LOG_COLUMN_STATUS_SUCCESS, thread_id); + MESA_handle_runtime_log(_instance->logger, + RLOG_LV_DEBUG, + "TSG_SEND_LOG", + "log send successfully %s: %s", + _instance->service2topic[topic_id].name, + payload + ); + } + + + - update_percent(_instance, topic_id, LOG_COLUMN_STATUS_SUCCESS, thread_id); update_percent(_instance, topic_id, LOG_COLUMN_STATUS_MAX, thread_id); return 0;