This commit is contained in:
@@ -60,7 +60,8 @@ var DaemonCmd = &cobra.Command{
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
||||
resultCh := make(chan *storage.LogEntry, 1000)
|
||||
go storage.Write(db, resultCh)
|
||||
var scanners []*parser.Scanner
|
||||
|
||||
for _, svc := range cfg.Service {
|
||||
@@ -98,16 +99,12 @@ var DaemonCmd = &cobra.Command{
|
||||
if svc.Name == "nginx" {
|
||||
log.Info("Starting nginx parser", "service", serviceName)
|
||||
ng := parser.NewNginxParser()
|
||||
resultCh := make(chan *storage.LogEntry, 100)
|
||||
ng.Parse(p.Events(), resultCh)
|
||||
go storage.Write(db, resultCh)
|
||||
}
|
||||
if svc.Name == "ssh" {
|
||||
log.Info("Starting ssh parser", "service", serviceName)
|
||||
ssh := parser.NewSshdParser()
|
||||
resultCh := make(chan *storage.LogEntry, 100)
|
||||
ssh.Parse(p.Events(), resultCh)
|
||||
go storage.Write(db, resultCh)
|
||||
}
|
||||
}(pars, svc.Name)
|
||||
continue
|
||||
@@ -128,16 +125,14 @@ var DaemonCmd = &cobra.Command{
|
||||
if svc.Name == "nginx" {
|
||||
log.Info("Starting nginx parser", "service", serviceName)
|
||||
ng := parser.NewNginxParser()
|
||||
resultCh := make(chan *storage.LogEntry, 100)
|
||||
ng.Parse(p.Events(), resultCh)
|
||||
go storage.Write(db, resultCh)
|
||||
|
||||
}
|
||||
if svc.Name == "ssh" {
|
||||
log.Info("Starting ssh parser", "service", serviceName)
|
||||
ssh := parser.NewSshdParser()
|
||||
resultCh := make(chan *storage.LogEntry, 100)
|
||||
ssh.Parse(p.Events(), resultCh)
|
||||
go storage.Write(db, resultCh)
|
||||
|
||||
}
|
||||
|
||||
}(pars, svc.Name)
|
||||
|
||||
2
go.mod
2
go.mod
@@ -6,6 +6,7 @@ require (
|
||||
github.com/BurntSushi/toml v1.6.0
|
||||
github.com/jedib0t/go-pretty/v6 v6.7.8
|
||||
github.com/spf13/cobra v1.10.2
|
||||
gopkg.in/natefinch/lumberjack.v2 v2.2.1
|
||||
modernc.org/sqlite v1.44.3
|
||||
)
|
||||
|
||||
@@ -22,7 +23,6 @@ require (
|
||||
golang.org/x/exp v0.0.0-20251023183803-a4bb9ffd2546 // indirect
|
||||
golang.org/x/sys v0.40.0 // indirect
|
||||
golang.org/x/text v0.32.0 // indirect
|
||||
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
|
||||
modernc.org/libc v1.67.6 // indirect
|
||||
modernc.org/mathutil v1.7.1 // indirect
|
||||
modernc.org/memory v1.11.0 // indirect
|
||||
|
||||
Reference in New Issue
Block a user