crowdsec: remove warning if prometheus port is taken during cold logs processing (#2857)
i.e. remove a "Warning: port is already in use" because it's probably LAPI
This commit is contained in:
parent
8108e4156d
commit
1eab943ec2
3 changed files with 9 additions and 2 deletions
|
@ -280,7 +280,7 @@ func waitOnTomb() {
|
|||
case <-acquisTomb.Dead():
|
||||
/*if it's acquisition dying it means that we were in "cat" mode.
|
||||
while shutting down, we need to give time for all buckets to process in flight data*/
|
||||
log.Warning("Acquisition is finished, shutting down")
|
||||
log.Info("Acquisition is finished, shutting down")
|
||||
/*
|
||||
While it might make sense to want to shut-down parser/buckets/etc. as soon as acquisition is finished,
|
||||
we might have some pending buckets: buckets that overflowed, but whose LeakRoutine are still alive because they
|
||||
|
|
|
@ -75,6 +75,10 @@ type Flags struct {
|
|||
CPUProfile string
|
||||
}
|
||||
|
||||
func (f *Flags) haveTimeMachine() bool {
|
||||
return f.OneShotDSN != ""
|
||||
}
|
||||
|
||||
type labelsMap map[string]string
|
||||
|
||||
func LoadBuckets(cConfig *csconfig.Config, hub *cwhub.Hub) error {
|
||||
|
|
|
@ -196,6 +196,9 @@ func servePrometheus(config *csconfig.PrometheusCfg, dbClient *database.Client,
|
|||
log.Debugf("serving metrics after %s ms", time.Since(crowdsecT0))
|
||||
|
||||
if err := http.ListenAndServe(fmt.Sprintf("%s:%d", config.ListenAddr, config.ListenPort), nil); err != nil {
|
||||
log.Warningf("prometheus: %s", err)
|
||||
// in time machine, we most likely have the LAPI using the port
|
||||
if !flags.haveTimeMachine() {
|
||||
log.Warningf("prometheus: %s", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue