summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfengweihao <[email protected]>2021-11-11 16:35:30 +0800
committerfengweihao <[email protected]>2021-11-11 16:35:30 +0800
commite4ed3b0b28863472c872e1eb4434cf27bbb3c6d6 (patch)
treef639f3d6cc51a61e184bf82489163138be073177
parent755c7efacf7f0359d406afb66dec618fba311b76 (diff)
feature: TSG-8451 Proxy增加HOS非格式化日志发送开关v4.5.24-20211111
-rw-r--r--conf/pangu/pangu_pxy.conf1
-rw-r--r--plugin/business/pangu-http/src/pangu_logger.cpp20
2 files changed, 16 insertions, 5 deletions
diff --git a/conf/pangu/pangu_pxy.conf b/conf/pangu/pangu_pxy.conf
index 617d4f8..414ddf6 100644
--- a/conf/pangu/pangu_pxy.conf
+++ b/conf/pangu/pangu_pxy.conf
@@ -4,6 +4,7 @@ enable_plugin=1
[log]
entrance_id=0
# default 1, if enable "en_sendlog", the iterm "tfe.conf [kafka] enable" must set 1
+en_hoslog=1
en_sendlog=1
#Addresses of hos, Bucket name in hos. Format is defined by WiredLB.
diff --git a/plugin/business/pangu-http/src/pangu_logger.cpp b/plugin/business/pangu-http/src/pangu_logger.cpp
index 421b811..33301a4 100644
--- a/plugin/business/pangu-http/src/pangu_logger.cpp
+++ b/plugin/business/pangu-http/src/pangu_logger.cpp
@@ -15,6 +15,7 @@ struct json_spec
struct pangu_logger
{
int entry_id;
+ unsigned int en_hoslog;
unsigned int en_sendlog;
const char *device_id;
const char *effective_device_tag;
@@ -50,6 +51,7 @@ struct pangu_logger* pangu_log_handle_create(const char* profile, const char* s
TFE_LOG_INFO(local_logger,"Pangu log is inititating from %s section %s.", profile, section);
MESA_load_profile_int_def(profile, section, "ENTRANCE_ID",&(instance->entry_id),0);
+ MESA_load_profile_uint_def(profile, section, "en_hoslog", &instance->en_hoslog, 1);
MESA_load_profile_uint_def(profile, section, "en_sendlog", &instance->en_sendlog, 1);
TFE_LOG_INFO(local_logger, "Pangu sendlog : %s", instance->en_sendlog ? "ENABLE" : "DISABLE");
@@ -67,13 +69,16 @@ struct pangu_logger* pangu_log_handle_create(const char* profile, const char* s
goto error_out;
}
- log_file_upload_para=cache_evbase_parameter_new(profile, section, local_logger);
- if (log_file_upload_para == NULL)
+ if(instance->en_hoslog==1)
{
- TFE_LOG_ERROR(local_logger, "Pangu failed to new cache evbase parameter.");
- goto error_out;
+ log_file_upload_para=cache_evbase_parameter_new(profile, section, local_logger);
+ if (log_file_upload_para == NULL)
+ {
+ TFE_LOG_ERROR(local_logger, "Pangu failed to new cache evbase parameter.");
+ goto error_out;
+ }
+ instance->log_file_upload_instance=cache_evbase_instance_new(log_file_upload_para, local_logger);
}
- instance->log_file_upload_instance=cache_evbase_instance_new(log_file_upload_para, local_logger);
return instance;
error_out:
@@ -260,6 +265,11 @@ int pangu_send_log(struct pangu_logger* handle, const struct pangu_log* log_msg)
continue;
}
+ if(handle->en_hoslog!=1)
+ {
+ continue;
+ }
+
struct tango_cache_meta_put meta;
char* log_file_key=NULL;;
const char* cont_type_val;