mirror of https://github.com/hashicorp/consul
[BUGFIX] Avoid GetDatacenter* methods to flood Consul servers logs
When calling `GetDatacentersByDistance()` or `GetDatacentersMap()`, an incorrect condition was used to diplay log message, thus flooding Consul's logs. Example of message: ``` [WARN] agent.router: Non-server in server-only area: non_server=myClientNode area=lan ``` This message is only valid for WAN areas, filter to avoid creating hundreds of logs/s on our clusters, each time someone is calling this method. Our logs were flooded by such messages when migrating our Consul servers from 1.7.7 to 1.8.4. This will issue fix #8663pull/8685/head
parent
86e7274a70
commit
638dcd3360
|
@ -536,10 +536,13 @@ func (r *Router) GetDatacentersByDistance() ([]string, error) {
|
||||||
for _, m := range info.cluster.Members() {
|
for _, m := range info.cluster.Members() {
|
||||||
ok, parts := metadata.IsConsulServer(m)
|
ok, parts := metadata.IsConsulServer(m)
|
||||||
if !ok {
|
if !ok {
|
||||||
|
if areaID != types.AreaLAN {
|
||||||
r.logger.Warn("Non-server in server-only area",
|
r.logger.Warn("Non-server in server-only area",
|
||||||
"non_server", m.Name,
|
"non_server", m.Name,
|
||||||
"area", areaID,
|
"area", areaID,
|
||||||
|
"func", "GetDatacentersByDistance",
|
||||||
)
|
)
|
||||||
|
}
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -547,6 +550,7 @@ func (r *Router) GetDatacentersByDistance() ([]string, error) {
|
||||||
r.logger.Debug("server in area left, skipping",
|
r.logger.Debug("server in area left, skipping",
|
||||||
"server", m.Name,
|
"server", m.Name,
|
||||||
"area", areaID,
|
"area", areaID,
|
||||||
|
"func", "GetDatacentersByDistance",
|
||||||
)
|
)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
@ -607,10 +611,13 @@ func (r *Router) GetDatacenterMaps() ([]structs.DatacenterMap, error) {
|
||||||
for _, m := range info.cluster.Members() {
|
for _, m := range info.cluster.Members() {
|
||||||
ok, parts := metadata.IsConsulServer(m)
|
ok, parts := metadata.IsConsulServer(m)
|
||||||
if !ok {
|
if !ok {
|
||||||
|
if areaID != types.AreaLAN {
|
||||||
r.logger.Warn("Non-server in server-only area",
|
r.logger.Warn("Non-server in server-only area",
|
||||||
"non_server", m.Name,
|
"non_server", m.Name,
|
||||||
"area", areaID,
|
"area", areaID,
|
||||||
|
"func", "GetDatacenterMaps",
|
||||||
)
|
)
|
||||||
|
}
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -618,6 +625,7 @@ func (r *Router) GetDatacenterMaps() ([]structs.DatacenterMap, error) {
|
||||||
r.logger.Debug("server in area left, skipping",
|
r.logger.Debug("server in area left, skipping",
|
||||||
"server", m.Name,
|
"server", m.Name,
|
||||||
"area", areaID,
|
"area", areaID,
|
||||||
|
"func", "GetDatacenterMaps",
|
||||||
)
|
)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue