maat json支持单独指定编译配置的表名。
This commit is contained in:
@@ -695,8 +695,12 @@ int write_compile_rule(cJSON *compile,struct iris_description_t *p_iris,void * l
|
|||||||
{
|
{
|
||||||
int compile_id=-1,cmd_cnt=0,ret=-1;
|
int compile_id=-1,cmd_cnt=0,ret=-1;
|
||||||
cJSON* item=NULL;
|
cJSON* item=NULL;
|
||||||
|
struct iris_table_t* table_info=NULL;
|
||||||
|
|
||||||
struct traslate_command_t compile_cmd[MAX_COLUMN_NUM];
|
struct traslate_command_t compile_cmd[MAX_COLUMN_NUM];
|
||||||
memset(compile_cmd,0,sizeof(compile_cmd));
|
memset(compile_cmd,0,sizeof(compile_cmd));
|
||||||
|
|
||||||
|
|
||||||
compile_cmd[cmd_cnt].json_string="compile_id";
|
compile_cmd[cmd_cnt].json_string="compile_id";
|
||||||
compile_cmd[cmd_cnt].json_type=cJSON_Number;
|
compile_cmd[cmd_cnt].json_type=cJSON_Number;
|
||||||
cmd_cnt++;
|
cmd_cnt++;
|
||||||
@@ -733,16 +737,25 @@ int write_compile_rule(cJSON *compile,struct iris_description_t *p_iris,void * l
|
|||||||
compile_cmd[cmd_cnt].str2int_flag=1;
|
compile_cmd[cmd_cnt].str2int_flag=1;
|
||||||
cmd_cnt++;
|
cmd_cnt++;
|
||||||
|
|
||||||
|
item=cJSON_GetObjectItem(compile,"table_name");
|
||||||
if(p_iris->compile_table.line_count==0)
|
if(item==NULL||item->type!=cJSON_String)
|
||||||
{
|
{
|
||||||
ret=set_file_rulenum(p_iris->compile_table.table_path, 0,logger);
|
table_info=&(p_iris->compile_table);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
table_info=query_table_info(p_iris,item->valuestring);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(table_info->line_count==0)
|
||||||
|
{
|
||||||
|
ret=set_file_rulenum(table_info->table_path, 0,logger);
|
||||||
if(ret<0)
|
if(ret<0)
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ret=direct_write_rule(compile, p_iris->str2int_map,compile_cmd,cmd_cnt, p_iris->compile_table.table_path,logger);
|
ret=direct_write_rule(compile, p_iris->str2int_map,compile_cmd,cmd_cnt, table_info->table_path,logger);
|
||||||
if(ret<0)
|
if(ret<0)
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
@@ -755,8 +768,8 @@ int write_compile_rule(cJSON *compile,struct iris_description_t *p_iris,void * l
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
compile_id=item->valueint;
|
compile_id=item->valueint;
|
||||||
p_iris->compile_table.line_count++;
|
table_info->line_count++;
|
||||||
set_file_rulenum(p_iris->compile_table.table_path,p_iris->compile_table.line_count,logger);
|
set_file_rulenum(table_info->table_path,table_info->line_count,logger);
|
||||||
return compile_id;
|
return compile_id;
|
||||||
}
|
}
|
||||||
int write_group_rule(int compile_id ,int group_id,struct iris_description_t *p_iris,void * logger)
|
int write_group_rule(int compile_id ,int group_id,struct iris_description_t *p_iris,void * logger)
|
||||||
@@ -1000,14 +1013,15 @@ int json2iris(const char* json_file,const char*compile_tn,const char* group_tn,r
|
|||||||
MESA_handle_runtime_log(logger,RLOG_LV_FATAL,maat_json,"Error before: %-200.200s",cJSON_GetErrorPtr());
|
MESA_handle_runtime_log(logger,RLOG_LV_FATAL,maat_json,"Error before: %-200.200s",cJSON_GetErrorPtr());
|
||||||
goto error_out;
|
goto error_out;
|
||||||
}
|
}
|
||||||
if(compile_tn==NULL)
|
tmp_obj=cJSON_GetObjectItem(json,"compile_table");
|
||||||
|
if(tmp_obj)
|
||||||
{
|
{
|
||||||
tmp_obj=cJSON_GetObjectItem(json,"compile_table");
|
|
||||||
compile_tn=tmp_obj->valuestring;
|
compile_tn=tmp_obj->valuestring;
|
||||||
}
|
}
|
||||||
if(group_tn==NULL)
|
|
||||||
|
tmp_obj=cJSON_GetObjectItem(json,"group_table");
|
||||||
|
if(tmp_obj)
|
||||||
{
|
{
|
||||||
tmp_obj=cJSON_GetObjectItem(json,"group_table");
|
|
||||||
group_tn=tmp_obj->valuestring;
|
group_tn=tmp_obj->valuestring;
|
||||||
}
|
}
|
||||||
ret=set_iris_descriptor(json_file,json,compile_tn,group_tn,redis_write_ctx,&iris_cfg,logger);
|
ret=set_iris_descriptor(json_file,json,compile_tn,group_tn,redis_write_ctx,&iris_cfg,logger);
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
"rules": [
|
"rules": [
|
||||||
{
|
{
|
||||||
"compile_id": 123,
|
"compile_id": 123,
|
||||||
|
"table_name": "COMPILE_ALIAS",
|
||||||
"service": 1,
|
"service": 1,
|
||||||
"action": 1,
|
"action": 1,
|
||||||
"do_blacklist": 1,
|
"do_blacklist": 1,
|
||||||
|
|||||||
@@ -1,35 +0,0 @@
|
|||||||
Load entry id 101 SUCCESS.
|
|
||||||
hit 1 rules
|
|
||||||
ipv4 scan hit compile rule id 123.
|
|
||||||
hit current region,but not hit compile rule.
|
|
||||||
ipv6 scan hit region.
|
|
||||||
digest scan hit 127.
|
|
||||||
digest scan hit 127.
|
|
||||||
digest scan hit 127.
|
|
||||||
digest scan hit 127.
|
|
||||||
digest scan hit 127.
|
|
||||||
digest scan hit 127.
|
|
||||||
Hit expr_plus rule 128.
|
|
||||||
URL encode scan utf8 url hit 1 rules, hit ruleid=129
|
|
||||||
URL encode scan gb2312 url hit 1 rules, hit ruleid=129
|
|
||||||
test_unicode_esc processing ./testdata_uni2ascii/original_Uygur_webpage.html
|
|
||||||
UNI2ASCII file ./testdata_uni2ascii/original_Uygur_webpage.html,hit 2 rules, hit ruleid=130 131
|
|
||||||
UNI2ASCII file ./testdata_uni2ascii/original_Uygur_webpage.html,hit 1 rules, hit ruleid=131
|
|
||||||
UNI2ASCII file ./testdata_uni2ascii/original_Uygur_webpage.html,hit 1 rules, hit ruleid=131
|
|
||||||
UNI2ASCII file ./testdata_uni2ascii/original_Uygur_webpage.html,hit 1 rules, hit ruleid=131
|
|
||||||
UNI2ASCII file ./testdata_uni2ascii/original_Uygur_webpage.html,hit 1 rules, hit ruleid=131
|
|
||||||
UNI2ASCII file ./testdata_uni2ascii/original_Uygur_webpage.html,hit 1 rules, hit ruleid=131
|
|
||||||
UNI2ASCII file ./testdata_uni2ascii/original_Uygur_webpage.html,hit 1 rules, hit ruleid=131
|
|
||||||
UNI2ASCII file ./testdata_uni2ascii/original_Uygur_webpage.html,hit 1 rules, hit ruleid=131
|
|
||||||
UNI2ASCII file ./testdata_uni2ascii/original_Uygur_webpage.html,hit 1 rules, hit ruleid=131
|
|
||||||
UNI2ASCII file ./testdata_uni2ascii/original_Uygur_webpage.html,hit 1 rules, hit ruleid=131
|
|
||||||
test_unicode_esc processing ./testdata_uni2ascii/original_uy.txt
|
|
||||||
UNI2ASCII file ./testdata_uni2ascii/original_uy.txt,hit 2 rules, hit ruleid=130 131
|
|
||||||
test_unicode_esc processing ./testdata_uni2ascii/qq_mail_https.txt
|
|
||||||
UNI2ASCII file ./testdata_uni2ascii/qq_mail_https.txt,hit 2 rules, hit ruleid=130 131
|
|
||||||
UNI2ASCII file ./testdata_uni2ascii/qq_mail_https.txt,hit 1 rules, hit ruleid=130
|
|
||||||
test_unicode_esc processing ./testdata_uni2ascii/sina_read_mail.txt
|
|
||||||
UNI2ASCII file ./testdata_uni2ascii/sina_read_mail.txt,hit 2 rules, hit ruleid=130 131
|
|
||||||
test_unicode_esc processing ./testdata_uni2ascii/sohu_mail_unicode.txt
|
|
||||||
UNI2ASCII file ./testdata_uni2ascii/sohu_mail_unicode.txt,hit 2 rules, hit ruleid=130 131
|
|
||||||
UNI2ASCII file ./testdata_uni2ascii/sohu_mail_unicode.txt,hit 2 rules, hit ruleid=130 131
|
|
||||||
@@ -28,4 +28,5 @@
|
|||||||
9 SIM_URL similar --
|
9 SIM_URL similar --
|
||||||
10 IMAGE_FP expr UTF8 UTF8 yes 128 quickoff
|
10 IMAGE_FP expr UTF8 UTF8 yes 128 quickoff
|
||||||
11 TEST_EFFECTIVE_RANGE_TABLE plugin {"valid":4,"tag":5} --
|
11 TEST_EFFECTIVE_RANGE_TABLE plugin {"valid":4,"tag":5} --
|
||||||
12 TEST_FOREIGN_KEY plugin {"valid":4,"foreign":"6,8","tag":3} --
|
12 TEST_FOREIGN_KEY plugin {"valid":4,"foreign":"6,8","tag":3} --
|
||||||
|
13 COMPILE_ALIAS compile escape --
|
||||||
|
|||||||
Reference in New Issue
Block a user