|
|
|
@ -41,6 +41,7 @@ class Anomalies(Thread) :
|
|
|
|
|
pass
|
|
|
|
|
def stop(self):
|
|
|
|
|
self.quit = True
|
|
|
|
|
|
|
|
|
|
def run(self):
|
|
|
|
|
DELAY = self.config['delay'] * 60
|
|
|
|
|
reader = self.factory.instance(type=self.rclass,args=self.rw_args)
|
|
|
|
@ -52,15 +53,16 @@ class Anomalies(Thread) :
|
|
|
|
|
while self.quit == False :
|
|
|
|
|
print ' *** ',self.name, ' ' , str(datetime.today())
|
|
|
|
|
for app in self.apps:
|
|
|
|
|
print '\t',str(datetime.today()),' ** ',app
|
|
|
|
|
print '\t',app,str(datetime.today()),' ** ',app
|
|
|
|
|
logs = ML.Filter('label',app,rdata)
|
|
|
|
|
|
|
|
|
|
if logs :
|
|
|
|
|
handler = AnomalyDetection()
|
|
|
|
|
value = handler.learn(logs,'label',app,features,yo)
|
|
|
|
|
print value
|
|
|
|
|
if value is not None:
|
|
|
|
|
value = dict(value,**{"features":features})
|
|
|
|
|
r[id][app] = value
|
|
|
|
|
value = dict({"id":self.id},**value)
|
|
|
|
|
#r[id][app] = value
|
|
|
|
|
self.lock.acquire()
|
|
|
|
|
writer = self.factory.instance(type=self.wclass,args=self.rw_args)
|
|
|
|
|
writer.write(label='learn',row=value)
|
|
|
|
|