HelenGuohx / logbert

log anomaly detection via BERT
MIT License
240 stars 102 forks source link

LogParser - drain parser is old version #38

Open Xtremely-Doped-Punk opened 1 year ago

Xtremely-Doped-Punk commented 1 year ago

this is the latest drain parser source code: https://github.com/logpai/logparser/blob/master/logparser/Drain/Drain.py and there seems to a problem with the get_parameter_list() in line 339, which was given as 'template_regex = re.sub(r' +', r'\s+', template_regex)' which is been causes the result's parameters to be empty list, also the original source code is not yet committed with the correct sequence code, this should do it. ''' def get_parameter_list(self, row): template_regex = re.sub(r"<.{1,5}>", "<>", row["EventTemplate"]) if "<>" not in template_regex: return [] template_regex = re.sub(r'([^A-Za-z0-9])', r'\\1', template_regex) template_regex = re.sub(r'\ +', r'\s+', template_regex) # changed template_regex = "^" + template_regex.replace("\<*>", "(.*?)") + "$" parameter_list = re.findall(template_regex, row["Content"]) parameter_list = parameter_list[0] if parameter_list else () parameter_list = list(parameter_list) if isinstance(parameter_list, tuple) else [parameter_list] return parameter_list '''