logpai / Drain3

A robust streaming log template miner based on the Drain algorithm

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

API document for Drain3

chenqiny opened this issue · comments

Is there any document about how to use Drain3 to inference and how to utilize the parsed result?

Is there any API document about how to use the functions in Drain3? Thanks.

Currently I am using the following code to parse log file with trained miner.

with open(log_file) as f:
    lines = f.readlines()
    for line in lines:
        cluster = template_miner.match(line)
        parms = template_miner.get_parameter_list(cluster.get_template(), line)
        print(cluster.get_template())
        print(parms)

Is it correct?

Better API documentation is indeed something we need. I will add few lines about inference in the readme.
Your code looks good, just that note the match() can return None if no match found.