From d93edf9880b794f26f32a11efe46ac9aac69e014 Mon Sep 17 00:00:00 2001 From: luwenpeng Date: Wed, 25 Sep 2024 09:44:08 +0800 Subject: [PATCH] feature(adapt maat): delete iris mode --- common/src/tfe_resource.cpp | 19 +------------------ conf/tfe/tfe.conf | 6 +----- plugin/business/traffic-mirror/src/entry.cpp | 11 ++--------- 3 files changed, 4 insertions(+), 32 deletions(-) diff --git a/common/src/tfe_resource.cpp b/common/src/tfe_resource.cpp index 3c47127..0dda9b1 100644 --- a/common/src/tfe_resource.cpp +++ b/common/src/tfe_resource.cpp @@ -8,7 +8,6 @@ #define MAAT_INPUT_JSON 0 #define MAAT_INPUT_REDIS 1 -#define MAAT_INPUT_FILE 2 static int scan_table_id[__SCAN_COMMON_TABLE_MAX]; static struct tfe_fieldstat_easy_t *fieldstat4_easy = NULL; @@ -104,7 +103,7 @@ static struct maat *create_maat_feather(const char *instance_name, const char *p struct maat *target=NULL; int input_mode = 0, maat_stat_on = 0, maat_perf_on = 0; int ret = 0, effect_interval = 60, log_level=0, max_size_mb=0; - char table_info[TFE_STRING_MAX] = {0}, inc_cfg_dir[TFE_STRING_MAX] = {0}, ful_cfg_dir[TFE_STRING_MAX] = {0}; + char table_info[TFE_STRING_MAX] = {0}; char redis_server[TFE_STRING_MAX] = {0}; char redis_port_range[TFE_STRING_MAX] = {0}; char accept_tags[TFE_STRING_MAX] = {0}; @@ -124,8 +123,6 @@ static struct maat *create_maat_feather(const char *instance_name, const char *p MESA_load_profile_string_def(profile, section, "maat_redis_server", redis_server, sizeof(redis_server), ""); MESA_load_profile_string_def(profile, section, "maat_redis_port_range", redis_port_range, sizeof(redis_server), "6379"); MESA_load_profile_int_def(profile, section, "maat_redis_db_index", &(redis_db_idx), 0); - MESA_load_profile_string_def(profile, section, "inc_cfg_dir", inc_cfg_dir, sizeof(inc_cfg_dir), ""); - MESA_load_profile_string_def(profile, section, "full_cfg_dir", ful_cfg_dir, sizeof(ful_cfg_dir), ""); MESA_load_profile_string_def(profile, section, "stat_file", maat_stat_file, sizeof(maat_stat_file), ""); MESA_load_profile_int_def(profile, section, "effect_interval_s", &(effect_interval), 60); MESA_load_profile_int_def(profile, section, "deferred_load_on", &(deferred_load_on), 0); @@ -174,20 +171,6 @@ static struct maat *create_maat_feather(const char *instance_name, const char *p } maat_options_set_redis(opts, redis_server, redis_port_select, redis_db_idx); break; - case MAAT_INPUT_FILE: - if (!strlen(ful_cfg_dir)) - { - TFE_LOG_ERROR(logger, "Invalid ful_cfg_dir, MAAT init failed."); - goto error_out; - } - - if (!strlen(inc_cfg_dir)) - { - TFE_LOG_ERROR(logger, "Invalid inc_cfg_dir, MAAT init failed."); - goto error_out; - } - maat_options_set_iris(opts, ful_cfg_dir, inc_cfg_dir); - break; default: TFE_LOG_ERROR(logger, "Invalid MAAT Input Mode: %d.", input_mode); goto error_out; diff --git a/conf/tfe/tfe.conf b/conf/tfe/tfe.conf index 3706ecd..c316b69 100644 --- a/conf/tfe/tfe.conf +++ b/conf/tfe/tfe.conf @@ -195,7 +195,7 @@ file_stream_topic=TRAFFIC-HTTP-FILE-STREAM-RECORD exch_cert_topic=PXY-EXCH-INTERMEDIA-CERT [maat] -# 0:json 1:redis 2:iris +# 0:json 1:redis maat_input_mode=1 stat_switch=1 perf_switch=1 @@ -213,10 +213,6 @@ maat_redis_server=10.4.34.4 maat_redis_port_range=6380-6389 maat_redis_db_index=4 -# iris mode conf iterm -full_cfg_dir=pangu_policy/full/index/ -inc_cfg_dir=pangu_policy/inc/index/ - [proxy_hits] app_name="proxy_rule_hits" output_fs_interval_ms=500 diff --git a/plugin/business/traffic-mirror/src/entry.cpp b/plugin/business/traffic-mirror/src/entry.cpp index 0701054..90f72c3 100644 --- a/plugin/business/traffic-mirror/src/entry.cpp +++ b/plugin/business/traffic-mirror/src/entry.cpp @@ -318,7 +318,6 @@ out: #define MAAT_INPUT_JSON 0 #define MAAT_INPUT_REDIS 1 -#define MAAT_INPUT_FILE 2 static struct maat* maat_feather_create_with_override(const char * instance_name, const char * profile, const char * section, const char * override_section, @@ -327,7 +326,7 @@ static struct maat* maat_feather_create_with_override(const char * instance_name struct maat *target=NULL; int input_mode = 0, maat_stat_on = 0, maat_perf_on = 0; int ret = 0, effect_interval = 60, log_level=0; - char table_info[TFE_STRING_MAX] = {0}, inc_cfg_dir[TFE_STRING_MAX] = {0}, ful_cfg_dir[TFE_STRING_MAX] = {0}; + char table_info[TFE_STRING_MAX] = {0}; char redis_server[TFE_STRING_MAX] = {0}; char redis_port_range[TFE_STRING_MAX] = {0}; char accept_tags[TFE_STRING_MAX] = {0}; @@ -365,8 +364,6 @@ static struct maat* maat_feather_create_with_override(const char * instance_name } MESA_load_profile_int_def(profile, section, "maat_redis_db_index", &(redis_db_idx), 0); - MESA_load_profile_string_def(profile, section, "inc_cfg_dir", inc_cfg_dir, sizeof(inc_cfg_dir), ""); - MESA_load_profile_string_def(profile, section, "full_cfg_dir", ful_cfg_dir, sizeof(ful_cfg_dir), ""); MESA_load_profile_string_def(profile, section, "stat_file", maat_stat_file, sizeof(maat_stat_file), ""); MESA_load_profile_int_def(profile, section, "effect_interval_s", &(effect_interval), 60); @@ -376,8 +373,7 @@ static struct maat* maat_feather_create_with_override(const char * instance_name MESA_load_profile_string_def(profile, override_section, "stat_file", maat_stat_file, sizeof(maat_stat_file), maat_stat_file); effect_interval *= 1000;//convert s to ms - assert(strlen(inc_cfg_dir) != 0 || strlen(ful_cfg_dir) != 0 || strlen(redis_server) != 0 - || strlen(json_cfg_file) != 0); + assert(strlen(redis_server) != 0 || strlen(json_cfg_file) != 0); struct maat_options *opts = maat_options_new(); maat_options_set_logger(opts, "log/maat.log", (enum log_level)log_level); @@ -392,9 +388,6 @@ static struct maat* maat_feather_create_with_override(const char * instance_name case MAAT_INPUT_REDIS: maat_options_set_redis(opts, redis_server, redis_port_select, redis_db_idx); break; - case MAAT_INPUT_FILE: - maat_options_set_iris(opts, ful_cfg_dir, inc_cfg_dir); - break; default: TFE_LOG_ERROR(logger, "Invalid MAAT Input Mode: %d.", input_mode); goto error_out; break;