diff options
| author | 杨威 <[email protected]> | 2020-10-27 17:15:09 +0800 |
|---|---|---|
| committer | 杨威 <[email protected]> | 2020-10-27 17:15:09 +0800 |
| commit | 66dda7ccffda14574212ec6ba36a9275c48946e1 (patch) | |
| tree | 10ae039c577cdf69785ff6d2fdb7c25805560621 | |
| parent | 6f81398dfda23cd5285e09c83507f16c1f7292f8 (diff) | |
✨feat(tsg_send_log.cpp): 按rfc7159定义的json输出number格式遵循IEEE 754标准,可能丢失精度,因此将stream_strace_id输出格式改成stringv3.3.5
| -rw-r--r-- | .gitignore | 2 | ||||
| -rw-r--r-- | cmake/Version.cmake | 2 | ||||
| -rw-r--r-- | src/tsg_send_log.cpp | 6 |
3 files changed, 7 insertions, 3 deletions
@@ -1 +1,3 @@ .vscode/* +build/ +cmake-build-* diff --git a/cmake/Version.cmake b/cmake/Version.cmake index 9b05d0b..a47944c 100644 --- a/cmake/Version.cmake +++ b/cmake/Version.cmake @@ -3,7 +3,7 @@ set(__SOURCE_AUTORESIVISION ${CMAKE_SOURCE_DIR}/autorevision.sh) set(__AUTORESIVISION ${CMAKE_BINARY_DIR}/autorevision.sh) -set(__VERSION_CACHE ${CMAKE_SOURCE_DIR}/version.txt) +set(__VERSION_CACHE ${CMAKE_BINARY_DIR}/version.txt) set(__VERSION_CONFIG ${CMAKE_BINARY_DIR}/version.cmake) file(COPY ${__SOURCE_AUTORESIVISION} DESTINATION ${CMAKE_BINARY_DIR} diff --git a/src/tsg_send_log.cpp b/src/tsg_send_log.cpp index 0c43608..6adc3b5 100644 --- a/src/tsg_send_log.cpp +++ b/src/tsg_send_log.cpp @@ -187,7 +187,7 @@ static int set_common_sub_action(struct TLD_handle_t *handle, char *field_name, int set_common_field_from_label(struct tsg_log_instance_t *_instance, struct TLD_handle_t *_handle, struct streaminfo *a_stream) { - char buff[512]={0}; + char buff[1024]={0}; struct _location_info_t *location=NULL; struct _session_attribute_label_t *internal_label=NULL; @@ -341,7 +341,9 @@ int TLD_append_streaminfo(struct tsg_log_instance_t *instance, struct TLD_handle } stream_id=tsg_get_stream_id(a_stream); - TLD_append(_handle, _instance->id2field[LOG_COMMON_STREAM_TRACE_ID].name, (void *)(long)stream_id, TLD_TYPE_LONG); + char stream_id_buff[128]=""; + snprintf(stream_id_buff, sizeof(stream_id_buff), "%llu", stream_id); + TLD_append(_handle, _instance->id2field[LOG_COMMON_STREAM_TRACE_ID].name, (void *)stream_id_buff, TLD_TYPE_STRING); addr_proto=(char *)layer_addr_prefix_ntop(a_stream); TLD_append(_handle, _instance->id2field[LOG_COMMON_L4_PROTOCOL].name, (void *)addr_proto, TLD_TYPE_STRING); |
