logpai / logparser

A machine learning toolkit for log parsing [ICSE'19, DSN'16]
Other
1.6k stars 551 forks source link

bad escape \s in Drain.py #84

Closed moesjo closed 2 years ago

moesjo commented 2 years ago

When running the demo script for drain to following error occures: re.error: bad escape \s at position 2 Changing line 339 in Drain.py from template_regex = re.sub(r'\\ +', r'\s+', template_regex) to template_regex = re.sub(r'\\ +', r'\\s+', template_regex) fixed the problem for me.

moesjo commented 2 years ago

Already included in several pull requests.

shoaib-intro commented 2 years ago

works with drain same issue with spell any idea?

moesjo commented 2 years ago

I think for spell it's pretty much the same, there should be a line similar to the one shown above and when you fill in the \ it should work. Maybe you should also consider using one of the forks of this project, there are some which already include the fixes for these issues (see pull-requests).

shoaib-intro commented 2 years ago

I think for spell it's pretty much the same, there should be a line similar to the one shown above and when you fill in the \ it should work. Maybe you should also consider using one of the forks of this project, there are some which already include the fixes for these issues (see pull-requests).

Thanks for reply but I even tried to change drain parameter code with spell does not works....even tried to change concerning line as well....spell keeps working for days but does not bring any output

moesjo commented 2 years ago

So i looked it up and from the syntax point of view you only have to change line 312 in Spell.py from

    splitter = re.sub(' +', '\s+', splitters[k])

to

    splitter = re.sub(' +', '\\\s+', splitters[k])
shoaib-intro commented 2 years ago

So i looked it up and from the syntax point of view you only have to change line 312 in Spell.py from

    splitter = re.sub(' +', '\s+', splitters[k])

to

    splitter = re.sub(' +', '\\\s+', splitters[k])

I have already tried this one, this works but only parameters extraction does not work however it works some other part of dataset but on some dataset having same size does not extract parameters.

moesjo commented 2 years ago

Okay, unfortunately I can't help you with this problem but i hope you'll find a fix for that!