Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing config object in sample files #31

Closed
RobinMaas95 opened this issue Apr 15, 2021 · 1 comment
Closed

Missing config object in sample files #31

RobinMaas95 opened this issue Apr 15, 2021 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@RobinMaas95
Copy link

Hey,
in both sample files no config object is passed to TemplateMiner. This should cause TemplateMiner to fall back to the default .ini file. However, if you use the call from the readme python -m examples.drain_stdin_demo to call the examples, there is no drain3.ini in the current working directory ("main" directory) and thus no config file is used. This leads to the fact that the examples cannot be reproduced, since no masking templates are used.

I think the cleanest way would be to create config objects in the examples.
Output of the current version:

python -m examples.drain_stdin_demo
Starting Drain3 template miner
Loading configuration from drain3.ini
config file not found: drain3.ini
Checking for saved state
Saved state not found
Drain3 started with 'FILE' persistence, reading from std-in (input 'q' to finish)
IP is 12.12.12.12
Saving state of 1 clusters with 1 messages, 352 bytes, reason: cluster_created (1)
{"change_type": "cluster_created", "cluster_id": 1, "cluster_size": 1, "template_mined": "IP is 12.12.12.12", "cluster_count": 1}

Proposed fix (e.g. drain_stdin_demo.py Line 45):

config = TemplateMinerConfig()
if os.path.exists(os.path.join("examples","drain3.ini")):
    config.load(os.path.join("examples","drain3.ini"))
else:
    logger.error("Drain3.ini file not found")

template_miner = TemplateMiner(persistence, config)

Fixed Output:

python -m examples.drain_stdin_demo
Starting Drain3 template miner
Checking for saved state
Saved state not found
Drain3 started with 'FILE' persistence, reading from std-in (input 'q' to finish)
IP is 12.12.12.12
Saving state of 1 clusters with 1 messages, 940 bytes, reason: cluster_created (1)
{"change_type": "cluster_created", "cluster_id": 1, "cluster_size": 1, "template_mined": "IP is <IP>", "cluster_count": 1}
@davidohana davidohana self-assigned this Apr 19, 2021
@davidohana davidohana added the bug Something isn't working label Apr 19, 2021
@davidohana
Copy link
Collaborator

Thanks for the report and the fix. Did a little different fix eventually but it should work now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants