summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorliuxueli <[email protected]>2020-06-18 14:11:02 +0800
committerliuxueli <[email protected]>2020-06-18 14:11:02 +0800
commit65833d7a1e16217953c490cdfa7002f4c07d5978 (patch)
treee23097c758a72c764b66ac74b066b1e8fa30a652
parenta556fb76b98f2b6811891bb7bdf72c9fbaced4a1 (diff)
tsg_stat.log按照influx_line格式输出到telegrafv1.3.3.20.07
IP归属地日志字段格式适配
-rw-r--r--src/tsg_entry.cpp3
-rw-r--r--src/tsg_send_log.cpp4
2 files changed, 5 insertions, 2 deletions
diff --git a/src/tsg_entry.cpp b/src/tsg_entry.cpp
index 3ee9402..c19b82f 100644
--- a/src/tsg_entry.cpp
+++ b/src/tsg_entry.cpp
@@ -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));
}
+ 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++)
{
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);
diff --git a/src/tsg_send_log.cpp b/src/tsg_send_log.cpp
index 44a0217..4e8828c 100644
--- a/src/tsg_send_log.cpp
+++ b/src/tsg_send_log.cpp
@@ -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);
}
}