From e4ed3b0b28863472c872e1eb4434cf27bbb3c6d6 Mon Sep 17 00:00:00 2001 From: fengweihao Date: Thu, 11 Nov 2021 16:35:30 +0800 Subject: [PATCH] =?UTF-8?q?feature:=20TSG-8451=20Proxy=E5=A2=9E=E5=8A=A0HO?= =?UTF-8?q?S=E9=9D=9E=E6=A0=BC=E5=BC=8F=E5=8C=96=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E5=8F=91=E9=80=81=E5=BC=80=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- conf/pangu/pangu_pxy.conf | 1 + .../business/pangu-http/src/pangu_logger.cpp | 20 ++++++++++++++----- 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;