Skip to content

Library Usage

Using patterndb-yaml as a Python library.

Installation

pip install patterndb-yaml

Quick Start

from patterndb_yaml import PatterndbYaml
from pathlib import Path

# Create processor
processor = PatterndbYaml(rules_path=Path("rules.yaml"))

# Process logs
with open("input.log") as infile, open("output.log", "w") as outfile:
    processor.process(infile, outfile)

# Get statistics
stats = processor.get_stats()
print(f"Match rate: {stats['match_rate']:.1%}")

See Also