feat: implement drain3 based generic log-parser

This commit is contained in:
Patryk Hegenberg 2026-01-18 16:51:44 +01:00
parent 1d1568e3ee
commit 5af49f926a
17 changed files with 612 additions and 220 deletions

View file

@ -96,7 +96,17 @@ type Config struct {
Level string `mapstructure:"level"`
FilePath string `mapstructure:"file_path"`
} `mapstructure:"logging"`
PatternsFile string `mapstructure:"patterns_file"`
PatternsFile string `mapstructure:"patterns_file"`
Drain3 Drain3Config `mapstructure:"drain3"`
}
type Drain3Config struct {
Enabled bool `mapstructure:"enabled"`
StateDir string `mapstructure:"state_dir"`
Depth int `mapstructure:"depth"`
SimThreshold float64 `mapstructure:"sim_th"`
MaxChildren int `mapstructure:"max_children"`
SaveIntervalSeconds int `mapstructure:"save_interval"`
}
type StorageRotationConfig struct {
@ -153,6 +163,11 @@ func setConfigDefaults() {
viper.SetDefault("localstorage.rotation.check_interval_minutes", 5)
viper.SetDefault("localstorage.rotation.archive_dir", "")
viper.SetDefault("patterns_file", "./configs/patterns.yaml")
viper.SetDefault("drain3.enabled", true)
viper.SetDefault("drain3.state_dir", "./drain3_states")
viper.SetDefault("drain3.depth", 4)
viper.SetDefault("drain3.sim_th", 0.4)
viper.SetDefault("drain3.max_children", 100)
}
func LoadConfig() (*Config, error) {