From 83801491c17353595f5c9a53a3524ab2cec6ef19 Mon Sep 17 00:00:00 2001 From: kcudnik Date: Fri, 24 May 2024 06:48:06 +0200 Subject: [PATCH] [orchagent] Do not pollute logs when unknown field is found This will prevent future unittest failing since there is syslog rate limitting in place, causing message drop when large amount of messages is arriving --- orchagent/port/porthlpr.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/orchagent/port/porthlpr.cpp b/orchagent/port/porthlpr.cpp index 80029cb569..3f937104ac 100644 --- a/orchagent/port/porthlpr.cpp +++ b/orchagent/port/porthlpr.cpp @@ -6,6 +6,7 @@ #include #include #include +#include #include @@ -777,6 +778,8 @@ bool PortHelper::parsePortConfig(PortConfig &port) const { SWSS_LOG_ENTER(); + std::set unknown; + for (const auto &cit : port.fieldValueMap) { const auto &field = cit.first; @@ -1029,6 +1032,11 @@ bool PortHelper::parsePortConfig(PortConfig &port) const } else { + if (unknown.find(field) != unknown.end()) + continue; // do not pollute logs with the same unknown field + + unknown.insert(field); + SWSS_LOG_WARN("Unknown field(%s): skipping ...", field.c_str()); } }