diff --git a/libnetwork/service_common.go b/libnetwork/service_common.go index 0ec4cb50e3..1780000d0d 100644 --- a/libnetwork/service_common.go +++ b/libnetwork/service_common.go @@ -287,7 +287,10 @@ func (c *controller) addServiceBinding(svcName, svcID, nID, eID, containerName s ok, entries := s.assignIPToEndpoint(ip.String(), eID) if !ok || entries > 1 { setStr, b := s.printIPToEndpoint(ip.String()) - logrus.Warnf("addServiceBinding %s possible transient state ok:%t entries:%d set:%t %s", eID, ok, entries, b, setStr[:maxSetStringLen]) + if len(setStr) > maxSetStringLen { + setStr = setStr[:maxSetStringLen] + } + logrus.Warnf("addServiceBinding %s possible transient state ok:%t entries:%d set:%t %s", eID, ok, entries, b, setStr) } // Add loadbalancer service and backend in all sandboxes in @@ -355,7 +358,10 @@ func (c *controller) rmServiceBinding(svcName, svcID, nID, eID, containerName st ok, entries := s.removeIPToEndpoint(ip.String(), eID) if !ok || entries > 0 { setStr, b := s.printIPToEndpoint(ip.String()) - logrus.Warnf("rmServiceBinding %s possible transient state ok:%t entries:%d set:%t %s", eID, ok, entries, b, setStr[:maxSetStringLen]) + if len(setStr) > maxSetStringLen { + setStr = setStr[:maxSetStringLen] + } + logrus.Warnf("rmServiceBinding %s possible transient state ok:%t entries:%d set:%t %s", eID, ok, entries, b, setStr) } // Remove loadbalancer service(if needed) and backend in all