场景
我们线上数据采集并补齐资产是通过flume的Interceptor实现的,这样的采集程序有很多,比如外连攻击的采集,蜜罐数据的采集,ddos攻击数据的采集,主机侧数据的采集等等,每个程序对应着不同的Interceptor。
后来我们增加了一个共有的需求,就是对没有补齐资产的攻击进行二次补齐,所以这个时候会有两套方案。第一:在之前的Intercetor里面加,这种不会增加新的类,但是需要修改类,并且会侵入之前的程序;第二:在之前的Intercetor后面添加新的Interceptor。最终我们采用的第二种
实现配置
a1.sources.r1.interceptors = i1 i2
a1.sources.r1.interceptors.i1.type = com.jd.sa.InternalAssetInterceptor$Builder
a1.sources.r1.interceptors.i1.info = ...
a1.sources.r1.interceptors.i2.type = com.jd.sa.InternalAssetInterceptor$Builder
a1.sources.r1.interceptors.i2.mysqlurl = jdbc:mysql://ssi-cert-m.mysql.jddb.jcloud.com:3358/jcloud_cap_ids?zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=UTF-8
a1.sources.r1.interceptors.i2.mysqlusername = jcap_ids_rw
a1.sources.r1.interceptors.i2.mysqlpassword = 0fd3aafab1d3f4b30b66f6909ac9ecfb95b00e65f9f98e85
a1.sources.r1.interceptors.i2.dbvalid = true
a1.sources.r1.interceptors.i2.dataexpired = 3600
这样就在已有的inteceptor后面添加了一个新的interceptor
网友评论