This commit is contained in:
Thibault bui Koechlin 2020-06-26 18:06:29 +02:00
parent 625e908894
commit c62e5d5aec
3 changed files with 7 additions and 8 deletions

View file

@ -119,7 +119,7 @@ func NewBackendPlugin(outputConfig map[string]string) (*BackendManager, error) {
if err != nil {
return nil, fmt.Errorf("plugin '%s' init error : %s", newPlugin.Name, err)
}
log.Infof("backend plugin '%s' loaded", newPlugin.Name)
log.Debugf("backend plugin '%s' loaded", newPlugin.Name)
backendManager.backendPlugins[newPlugin.Name] = newPlugin
}

View file

@ -55,7 +55,7 @@ func (c *Context) CleanUpRecordsByAge() error {
//no events elligible
if len(sos) == 0 || ret.RowsAffected == 0 {
log.Infof("no event older than %s", c.maxDurationRetention.String())
log.Debugf("no event older than %s", c.maxDurationRetention.String())
return nil
}
//let's do it in a single transaction
@ -91,7 +91,7 @@ func (c *Context) CleanUpRecordsByCount() error {
return errors.Wrap(ret.Error, "failed to get bans count")
}
if count < c.maxEventRetention {
log.Infof("%d < %d, don't cleanup", count, c.maxEventRetention)
log.Debugf("%d < %d, don't cleanup", count, c.maxEventRetention)
return nil
}
@ -130,12 +130,12 @@ func (c *Context) CleanUpRecordsByCount() error {
}
func (c *Context) AutoCommit() {
log.Warningf("starting autocommit")
log.Infof("starting autocommit")
ticker := time.NewTicker(200 * time.Millisecond)
cleanUpTicker := time.NewTicker(1 * time.Minute)
expireTicker := time.NewTicker(1 * time.Second)
if !c.flush {
log.Infof("flush is disabled")
log.Debugf("flush is disabled")
}
for {
select {

View file

@ -52,7 +52,7 @@ func NewSQLite(cfg map[string]string) (*Context, error) {
if cfg["db_path"] == "" {
return nil, fmt.Errorf("please specify a 'db_path' to SQLite db in the configuration")
}
log.Warningf("Starting SQLite backend, path:%s", cfg["db_path"])
log.Infof("Starting SQLite backend, path:%s", cfg["db_path"])
c.Db, err = gorm.Open("sqlite3", cfg["db_path"]+"?_busy_timeout=1000")
if err != nil {
@ -84,8 +84,7 @@ func NewSQLite(cfg map[string]string) (*Context, error) {
if c.tx == nil {
return nil, fmt.Errorf("failed to begin sqlite transac : %s", err)
}
//random attempt
//c.maxEventRetention = 100
//TBD : we shouldn't start auto-commit if we are in cli mode ?
c.PusherTomb.Go(func() error {
c.AutoCommit()
return nil