logpai / Drain3

A robust streaming log template miner based on the Drain algorithm
Other
470 stars 134 forks source link

Issue with match method in Drain class #59

Closed jona-sch closed 2 years ago

jona-sch commented 2 years ago

There seems to be an issue with match method in the Drain class. When configuring a template miner with a config file with masking (e.g. masking = [{"regex_pattern":"((?<=[^A-Za-z0-9])|^)([\\-\\+]?\\d+)((?=[^A-Za-z0-9])|$)", "mask_with": "NUM"}]) and mining all templates, it becomes impossible to match lines containing tokens that fit the regex patterns defined in the config file.

Example: with the same config file, imagine I get templates ID=1 : size=100 : RAS node <:NUM:> ID=2 : size=10 : RAS error <:NUM:>. Then template_miner.drain.match("RAS node 12334") will return None and not the first template.

jona-sch commented 2 years ago

Well after examining the code a little bit more, I found out the right method for my use case was in the TemplateMiner class.