tsg_stat.log按照influx_line格式输出到telegraf

IP归属地日志字段格式适配
This commit is contained in:
liuxueli
2020-06-18 14:11:02 +08:00
parent a556fb76b9
commit 65833d7a1e
2 changed files with 5 additions and 2 deletions

View File

@@ -191,14 +191,14 @@ int set_common_field_from_label(struct tsg_log_instance_t *_instance, struct TLD
if(internal_label->client_location!=NULL)
{
location=internal_label->client_location;
snprintf(buff, sizeof(buff), "%s%s%s%s%s", location->country_full, (strlen(location->province_full)>0) ? "," : "", location->province_full, (strlen(location->city_full)>0) ? "," : "", location->city_full);
snprintf(buff, sizeof(buff), "%s,%s,%s", location->city_full, location->province_full, location->country_full);
TLD_append(_handle, _instance->id2field[LOG_COMMON_CLINET_LOCATION].name, (void *)buff, TLD_TYPE_STRING);
}
if(internal_label->server_location!=NULL)
{
location=internal_label->server_location;
snprintf(buff, sizeof(buff), "%s%s%s%s%s", location->country_full, (strlen(location->province_full)>0) ? "," : "", location->province_full, (strlen(location->city_full)>0) ? "," : "", location->city_full);
snprintf(buff, sizeof(buff), "%s,%s,%s", location->city_full, location->province_full, location->country_full);
TLD_append(_handle, _instance->id2field[LOG_COMMON_SERVER_LOCATION].name, (void *)buff, TLD_TYPE_STRING);
}
}