tsg_stat.log按照influx_line格式输出到telegraf
IP归属地日志字段格式适配
This commit is contained in:
@@ -985,6 +985,9 @@ extern "C" int TSG_MASTER_INIT()
|
|||||||
FS_set_para(g_tsg_para.fs2_handle, STATS_SERVER_PORT,&(fs_server_port), sizeof(fs_server_port));
|
FS_set_para(g_tsg_para.fs2_handle, STATS_SERVER_PORT,&(fs_server_port), sizeof(fs_server_port));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
value=FS_OUTPUT_INFLUX_LINE;
|
||||||
|
FS_set_para(g_tsg_para.fs2_handle, STATS_FORMAT, &value, sizeof(value));
|
||||||
|
|
||||||
for(i=0; i<TSG_FS2_MAX; i++)
|
for(i=0; i<TSG_FS2_MAX; i++)
|
||||||
{
|
{
|
||||||
g_tsg_para.fs2_field_id[g_tsg_fs2_field[i].id]=FS_register(g_tsg_para.fs2_handle, FS_STYLE_FIELD, FS_CALC_CURRENT, g_tsg_fs2_field[i].name);
|
g_tsg_para.fs2_field_id[g_tsg_fs2_field[i].id]=FS_register(g_tsg_para.fs2_handle, FS_STYLE_FIELD, FS_CALC_CURRENT, g_tsg_fs2_field[i].name);
|
||||||
|
|||||||
@@ -191,14 +191,14 @@ int set_common_field_from_label(struct tsg_log_instance_t *_instance, struct TLD
|
|||||||
if(internal_label->client_location!=NULL)
|
if(internal_label->client_location!=NULL)
|
||||||
{
|
{
|
||||||
location=internal_label->client_location;
|
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);
|
TLD_append(_handle, _instance->id2field[LOG_COMMON_CLINET_LOCATION].name, (void *)buff, TLD_TYPE_STRING);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(internal_label->server_location!=NULL)
|
if(internal_label->server_location!=NULL)
|
||||||
{
|
{
|
||||||
location=internal_label->server_location;
|
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);
|
TLD_append(_handle, _instance->id2field[LOG_COMMON_SERVER_LOCATION].name, (void *)buff, TLD_TYPE_STRING);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user