Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 19 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import (
"context"
"log"
"os"
"os/signal"
"strings"
"syscall"

"github.com/akto-api-security/api-gateway-logging/logprocesser"
"github.com/akto-api-security/api-gateway-logging/trafficUtil/kafkaUtil"
Expand Down Expand Up @@ -61,10 +64,22 @@ func main() {

kafkaUtil.InitKafka()

utils.DebugLog("Starting log processer for log group: %s", logGroupArn)
logGroupArns := strings.Split(logGroupArn, ",")

// Start monitoring the log group
if err := logprocesser.MonitorLogGroup(context.TODO(), client, logGroupArn); err != nil {
log.Fatalf("Error monitoring log group: %v", err)
for _, logGroupArnTemp := range logGroupArns {
// Start monitoring the log group
logGroupArnTemp = strings.Trim(logGroupArnTemp, " ")
go func() {
utils.DebugLog("Starting log processor for log group: %s", logGroupArnTemp)
if err := logprocesser.MonitorLogGroup(context.TODO(), client, logGroupArnTemp); err != nil {
log.Fatalf("Error monitoring log group: %v", err)
}
}()
}

sig := make(chan os.Signal, 1)
signal.Notify(sig, syscall.SIGHUP, syscall.SIGINT, syscall.SIGQUIT, syscall.SIGTERM)
<-sig
log.Println("Signaled to terminate")

}
Loading