Currently, messages such as (address cache) Adding cache entry: 11:22:33:44:55:66 ---> 10.20.30.40 are displayed for every IP address assignment caught by tcpdump. These often occur in clusters. Therefore, to avoid bloating the log files, print a message only if the last message for the same MAC address was printed more than 5 seconds ago. Signed-off-by: Michael Goldish <mgoldish@xxxxxxxxxx> --- client/tests/kvm/kvm_preprocessing.py | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/client/tests/kvm/kvm_preprocessing.py b/client/tests/kvm/kvm_preprocessing.py index d2f94cd..90382cc 100644 --- a/client/tests/kvm/kvm_preprocessing.py +++ b/client/tests/kvm/kvm_preprocessing.py @@ -384,9 +384,11 @@ def _update_address_cache(address_cache, line): matches = re.findall(r"\w*:\w*:\w*:\w*:\w*:\w*", line) if matches and address_cache.get("last_seen"): mac_address = matches[0].lower() - logging.debug("(address cache) Adding cache entry: %s ---> %s", - mac_address, address_cache.get("last_seen")) + if time.time() - address_cache.get("time_%s" % mac_address, 0) > 5: + logging.debug("(address cache) Adding cache entry: %s ---> %s", + mac_address, address_cache.get("last_seen")) address_cache[mac_address] = address_cache.get("last_seen") + address_cache["time_%s" % mac_address] = time.time() del address_cache["last_seen"] -- 1.7.3.3 -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html