Skip to content
Prev Previous commit
Next Next commit
SLCT fix for Python 3.9
  • Loading branch information
moesjo committed Aug 18, 2022
commit a7ea00c059d46168848fa1063dff92e652784879
2 changes: 1 addition & 1 deletion logparser/SLCT/SLCT.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def generate_logformat_regex(logformat):
regex = ''
for k in range(len(splitters)):
if k % 2 == 0:
splitter = re.sub(' +', '\s+', splitters[k])
splitter = re.sub(' +', '\\\s+', splitters[k])
regex += splitter
else:
header = splitters[k].strip('<').strip('>')
Expand Down
2 changes: 1 addition & 1 deletion logparser/SLCT/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from SLCT import *
from .SLCT import *
4 changes: 2 additions & 2 deletions logparser/logmatch/regexmatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def match(self, log_filepath, template_filepath):

def _dump_match_result(self, log_filename, log_dataframe):
log_dataframe.to_csv(os.path.join(self.outdir, log_filename + '_structured.csv'), index=False)
template_freq_list = [[eventId, template, freq] for (eventId, template), freq in self.template_freq_dict.iteritems()]
template_freq_list = [[eventId, template, freq] for (eventId, template), freq in self.template_freq_dict.items()]
template_freq_df = pd.DataFrame(template_freq_list, columns=['EventId', 'EventTemplate', 'Occurrences'])
template_freq_df.to_csv(os.path.join(self.outdir, log_filename + '_templates.csv'), index=False)

Expand Down Expand Up @@ -160,7 +160,7 @@ def regex_match(msg, template_match_dict, optimized):
if len(match_dict) > 1:
match_dict = OrderedDict(sorted(match_dict.items(),
key=lambda x: (len(x[1][1]), -x[1][1].count('<*>')), reverse=True))
for regex, event in match_dict.iteritems():
for regex, event in match_dict.items():
parameter_list = re.findall(regex, msg.strip())
if parameter_list:
matched_event = event
Expand Down