chore: version 1.0.6 - simplify YAML configuration
- Remove service.name and service.language (unused) - Remove enabled flags on outputs (presence = enabled) - Simplify correlation config: time_window_s (integer) instead of nested object - Simplify orphan_policy to emit_orphans boolean - Rename apache socket to http.socket - Add socket_permissions option for unix sockets (default: 0660) - Update tests for new configuration format Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
@ -39,7 +39,7 @@ func main() {
|
||||
}
|
||||
|
||||
// Initialize logger
|
||||
logger := observability.NewLogger(cfg.Service.Name)
|
||||
logger := observability.NewLogger("logcorrelator")
|
||||
|
||||
logger.Info(fmt.Sprintf("Starting logcorrelator version %s", Version))
|
||||
|
||||
@ -47,18 +47,19 @@ func main() {
|
||||
sources := make([]ports.EventSource, 0, len(cfg.Inputs.UnixSockets))
|
||||
for _, inputCfg := range cfg.Inputs.UnixSockets {
|
||||
source := unixsocket.NewUnixSocketSource(unixsocket.Config{
|
||||
Name: inputCfg.Name,
|
||||
Path: inputCfg.Path,
|
||||
SourceType: inputCfg.SourceType,
|
||||
Name: inputCfg.Name,
|
||||
Path: inputCfg.Path,
|
||||
SourceType: inputCfg.SourceType,
|
||||
SocketPermissions: inputCfg.GetSocketPermissions(),
|
||||
})
|
||||
sources = append(sources, source)
|
||||
logger.Info(fmt.Sprintf("Configured input source: name=%s, path=%s", inputCfg.Name, inputCfg.Path))
|
||||
logger.Info(fmt.Sprintf("Configured input source: name=%s, path=%s, permissions=%o", inputCfg.Name, inputCfg.Path, inputCfg.GetSocketPermissions()))
|
||||
}
|
||||
|
||||
// Create sinks
|
||||
sinks := make([]ports.CorrelatedLogSink, 0)
|
||||
|
||||
if cfg.Outputs.File.Enabled {
|
||||
if cfg.Outputs.File.Path != "" {
|
||||
fileSink, err := file.NewFileSink(file.Config{
|
||||
Path: cfg.Outputs.File.Path,
|
||||
})
|
||||
@ -89,9 +90,9 @@ func main() {
|
||||
logger.Info(fmt.Sprintf("Configured ClickHouse sink: table=%s", cfg.Outputs.ClickHouse.Table))
|
||||
}
|
||||
|
||||
if cfg.Outputs.Stdout.Enabled {
|
||||
if cfg.Outputs.Stdout {
|
||||
stdoutSink := stdout.NewStdoutSink(stdout.Config{
|
||||
Enabled: cfg.Outputs.Stdout.Enabled,
|
||||
Enabled: true,
|
||||
})
|
||||
sinks = append(sinks, stdoutSink)
|
||||
logger.Info("Configured stdout sink")
|
||||
@ -103,15 +104,14 @@ func main() {
|
||||
// Create correlation service
|
||||
correlationSvc := domain.NewCorrelationService(domain.CorrelationConfig{
|
||||
TimeWindow: cfg.Correlation.GetTimeWindow(),
|
||||
ApacheAlwaysEmit: cfg.Correlation.OrphanPolicy.ApacheAlwaysEmit,
|
||||
NetworkEmit: cfg.Correlation.OrphanPolicy.NetworkEmit,
|
||||
ApacheAlwaysEmit: cfg.Correlation.EmitOrphans,
|
||||
NetworkEmit: false,
|
||||
MaxBufferSize: domain.DefaultMaxBufferSize,
|
||||
}, &domain.RealTimeProvider{})
|
||||
|
||||
logger.Info(fmt.Sprintf("Correlation service initialized: time_window=%s, apache_always_emit=%v, network_emit=%v",
|
||||
logger.Info(fmt.Sprintf("Correlation service initialized: time_window=%s, emit_orphans=%v",
|
||||
cfg.Correlation.GetTimeWindow().String(),
|
||||
cfg.Correlation.OrphanPolicy.ApacheAlwaysEmit,
|
||||
cfg.Correlation.OrphanPolicy.NetworkEmit))
|
||||
cfg.Correlation.EmitOrphans))
|
||||
|
||||
// Create orchestrator
|
||||
orchestrator := app.NewOrchestrator(app.OrchestratorConfig{
|
||||
|
||||
Reference in New Issue
Block a user