瀏覽代碼

make StartAutoCommit to control background routine

Thibault bui Koechlin 5 年之前
父節點
當前提交
17a2722004
共有 1 個文件被更改,包括 5 次插入0 次删除
  1. 5 0
      cmd/crowdsec/main.go

+ 5 - 0
cmd/crowdsec/main.go

@@ -14,6 +14,7 @@ import (
 	"github.com/crowdsecurity/crowdsec/pkg/outputs"
 	"github.com/crowdsecurity/crowdsec/pkg/parser"
 	"github.com/crowdsecurity/crowdsec/pkg/types"
+	"github.com/pkg/errors"
 	"github.com/sevlyar/go-daemon"
 
 	log "github.com/sirupsen/logrus"
@@ -163,6 +164,10 @@ func LoadOutputs(cConfig *csconfig.CrowdSec) error {
 		return fmt.Errorf("output plugins initialization error : %s", err.Error())
 	}
 
+	if err := OutputRunner.StartAutoCommit(); err != nil {
+		return errors.Wrap(err, "failed to start autocommit")
+	}
+
 	/* Init the API connector */
 	if cConfig.APIMode {
 		log.Infof("Loading API client")