数据库和数据清理脚本更新以反映属性变化

- 删除了`interface`属性并引入了`service_name`属性。
- 在`base_dataclean_pg.py`中更新了数据聚合字段,以匹配数据库中的属性变更。
- 确保了数据清理脚本与数据库架构保持同步,并能正确处理新的属性名称。
dev
TANGWY 1 month ago
parent 1cd91ba637
commit e49d07391b
  1. 4
      sql/pg_data.sql
  2. 4
      utils/base_dataclean_pg.py

@ -2,6 +2,6 @@
delete from isop_diting.tb_cep_attr where attr_name = 'trojan_type'; delete from isop_diting.tb_cep_attr where attr_name = 'trojan_type';
delete from isop_diting.tb_cep_attr where attr_name = 'account'; delete from isop_diting.tb_cep_attr where attr_name = 'account';
delete from isop_diting.tb_cep_attr where attr_name = 'worm_family'; delete from isop_diting.tb_cep_attr where attr_name = 'worm_family';
delete from isop_diting.tb_cep_attr where attr_name = 'interface'; delete from isop_diting.tb_cep_attr where attr_name = 'service_name';
INSERT INTO isop_diting.tb_cep_attr (attr_name, attr_type, is_system,is_common) INSERT INTO isop_diting.tb_cep_attr (attr_name, attr_type, is_system,is_common)
VALUES ('trojan_type', 'String', '1','1'),('interface', 'String','1','1'),('worm_family', 'String','1','1'),('account', 'String','1','1'); VALUES ('trojan_type', 'String', '1','1'),('service_name', 'String','1','1'),('worm_family', 'String','1','1'),('account', 'String','1','1');

@ -134,7 +134,7 @@ def get_interface_group_data(index,startTime,endTime,diplist):
"composite": { "composite": {
"size": size, "size": size,
"sources": [ "sources": [
{"interface": { "terms": {"field": "interface"} }}, {"service_name": { "terms": {"field": "service_name"} }},
{"sip": { "terms": { "field": "sip"}}}, {"sip": { "terms": { "field": "sip"}}},
{"account": { "terms": { "field": "account"}}}, {"account": { "terms": { "field": "account"}}},
{"trojan_type": { "terms": { "field": "trojan_type"}}} {"trojan_type": { "terms": { "field": "trojan_type"}}}
@ -156,7 +156,7 @@ def get_interface_group_data(index,startTime,endTime,diplist):
"account": bucket['key']['account'], "account": bucket['key']['account'],
"count": bucket['doc_count'], "count": bucket['doc_count'],
"jobnum": bucket['key']['trojan_type'] , "jobnum": bucket['key']['trojan_type'] ,
"interface": bucket['key']['interface'] , "interface": bucket['key']['service_name'] ,
"ip":bucket['key']['sip'] "ip":bucket['key']['sip']
} }
datas.append(data) datas.append(data)

Loading…
Cancel
Save