MCPcopy Create free account
hub / github.com/logpai/logparser / parse

Method parse

logparser/SHISO/SHISO.py:357–386  ·  view source on GitHub ↗
(self, logname)

Source from the content-addressed store, hash-verified

355 self.printTree(child, dep + 1)
356
357 def parse(self, logname):
358 print("Parsing file: " + os.path.join(self.path, logname))
359 self.logname = logname
360 starttime = datetime.now()
361 rootNode = Node()
362 self.load_data()
363
364 count = 0
365 for idx, line in tqdm(self.df_log.iterrows(), total=len(self.df_log)):
366 ID = line["LineId"]
367 logmessageL = line["Content"]
368 if self.rex:
369 for currentRex in self.rex:
370 logmessageL = re.sub(currentRex, "<*>", logmessageL)
371 logmessageL = logmessageL.strip().split()
372 currentNode = Node(format=logmessageL, logIDL=[ID])
373
374 (parentNode, newIdx, newFormNode, hasNewForm) = self.Search(
375 n=currentNode, nroot=rootNode
376 )
377
378 if hasNewForm:
379 self.Adjust(pn=parentNode, nidx=newIdx, n=newFormNode)
380 count += 1
381
382 if not os.path.exists(self.savePath):
383 os.makedirs(self.savePath)
384
385 self.outputResult(rootNode)
386 print("Parsing done. [Time taken: {!s}]".format(datetime.now() - starttime))
387
388 def load_data(self):
389 headers, regex = self.generate_logformat_regex(self.logformat)

Callers 2

benchmark.pyFile · 0.45
demo.pyFile · 0.45

Calls 6

load_dataMethod · 0.95
SearchMethod · 0.95
AdjustMethod · 0.95
outputResultMethod · 0.95
formatMethod · 0.80
NodeClass · 0.70

Tested by

no test coverage detected