Logarithm::Config
Inherits YAML::Serializable < Reference < Object
Configuration management for Logarithm.
This class handles all configuration settings for the anomaly detection system, supporting YAML configuration files, environment variables, and programmatic configuration. It provides sensible defaults and validation.
Configuration Sources (in precedence order)
- Command-line flags (highest priority)
- Environment variables
- YAML configuration file
- Built-in defaults (lowest priority)
Configuration File Format
# /etc/logarithm/config.yaml or ~/.config/logarithm/config.yaml
data_dir: ~/.local/share/logarithm
threshold: 0.85
duration: 48h
vocab_size: 1000
batch_size: 10000
max_batches: 5
Environment Variables
LOGARITHM_DATA_DIR: Model and data storage directoryLOGARITHM_THRESHOLD: Anomaly detection sensitivity (0.0-1.0)LOGARITHM_VOCAB_SIZE: TF-IDF vocabulary sizeLOGARITHM_BATCH_SIZE: Training batch sizeLOGARITHM_MAX_BATCHES: Maximum training batches
Example Usage
# Load from file
config = Config.load("config.yaml")
# Create with defaults
config = Config.new
# Override specific settings
config = Config.new(
threshold: 0.9,
vocab_size: 2000
)
# Use in pipeline
pipeline = Pipeline.new(source, vectorizer, model, config)
Constructors
Creates a new configuration with specified or default values.
Uses PathResolver for smart default data directory detection.
Class methods
Instance methods
Number of log entries to process in each training batch. Larger batches may improve training stability but use more memory.
Number of log entries to process in each training batch. Larger batches may improve training stability but use more memory.
Directory for storing trained models, logs, and temporary files. Defaults to XDG data directory (~/.local/share/logarithm).
Directory for storing trained models, logs, and temporary files. Defaults to XDG data directory (~/.local/share/logarithm).
Default training duration when not specified via CLI. Format: "30s", "5m", "2h", "1d" (seconds, minutes, hours, days).
Default training duration when not specified via CLI. Format: "30s", "5m", "2h", "1d" (seconds, minutes, hours, days).
Maximum number of training batches to process. Limits training time and prevents overfitting on repetitive logs.
Maximum number of training batches to process. Limits training time and prevents overfitting on repetitive logs.
Anomaly detection threshold (0.0 to 1.0).
Lower values increase sensitivity (more false positives). Higher values decrease sensitivity (more false negatives). Typical range: 0.7-0.95 depending on log noise levels.
Anomaly detection threshold (0.0 to 1.0).
Lower values increase sensitivity (more false positives). Higher values decrease sensitivity (more false negatives). Typical range: 0.7-0.95 depending on log noise levels.
Maximum size of TF-IDF vocabulary. Larger vocabularies capture more terms but increase memory usage. Typical range: 100-5000 depending on log complexity.