feature: TSG-8451 Proxy增加HOS非格式化日志发送开关
This commit is contained in:
@@ -4,6 +4,7 @@ enable_plugin=1
|
|||||||
[log]
|
[log]
|
||||||
entrance_id=0
|
entrance_id=0
|
||||||
# default 1, if enable "en_sendlog", the iterm "tfe.conf [kafka] enable" must set 1
|
# default 1, if enable "en_sendlog", the iterm "tfe.conf [kafka] enable" must set 1
|
||||||
|
en_hoslog=1
|
||||||
en_sendlog=1
|
en_sendlog=1
|
||||||
|
|
||||||
#Addresses of hos, Bucket name in hos. Format is defined by WiredLB.
|
#Addresses of hos, Bucket name in hos. Format is defined by WiredLB.
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ struct json_spec
|
|||||||
struct pangu_logger
|
struct pangu_logger
|
||||||
{
|
{
|
||||||
int entry_id;
|
int entry_id;
|
||||||
|
unsigned int en_hoslog;
|
||||||
unsigned int en_sendlog;
|
unsigned int en_sendlog;
|
||||||
const char *device_id;
|
const char *device_id;
|
||||||
const char *effective_device_tag;
|
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);
|
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_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);
|
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");
|
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;
|
goto error_out;
|
||||||
}
|
}
|
||||||
|
|
||||||
log_file_upload_para=cache_evbase_parameter_new(profile, section, local_logger);
|
if(instance->en_hoslog==1)
|
||||||
if (log_file_upload_para == NULL)
|
|
||||||
{
|
{
|
||||||
TFE_LOG_ERROR(local_logger, "Pangu failed to new cache evbase parameter.");
|
log_file_upload_para=cache_evbase_parameter_new(profile, section, local_logger);
|
||||||
goto error_out;
|
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;
|
return instance;
|
||||||
|
|
||||||
error_out:
|
error_out:
|
||||||
@@ -260,6 +265,11 @@ int pangu_send_log(struct pangu_logger* handle, const struct pangu_log* log_msg)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(handle->en_hoslog!=1)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
struct tango_cache_meta_put meta;
|
struct tango_cache_meta_put meta;
|
||||||
char* log_file_key=NULL;;
|
char* log_file_key=NULL;;
|
||||||
const char* cont_type_val;
|
const char* cont_type_val;
|
||||||
|
|||||||
Reference in New Issue
Block a user