[OBJECT-138] Executive command changed

Added exception of error 'Too many requests' in log analyzer and fixed arguments ordr in get_filtered_logs

Signed-off-by: Mikhail Kadilov m.kadilov@yadro.com
This commit is contained in:
Mikhail Kadilov 2023-12-06 17:58:06 +03:00
parent 8966ec20f2
commit 5bebfddc33
2 changed files with 6 additions and 0 deletions

View file

@ -235,6 +235,7 @@ class DockerHost(Host):
since: Optional[datetime] = None, since: Optional[datetime] = None,
until: Optional[datetime] = None, until: Optional[datetime] = None,
unit: Optional[str] = None, unit: Optional[str] = None,
exclude_filter: Optional[str] = None,
) -> str: ) -> str:
client = self._get_docker_client() client = self._get_docker_client()
filtered_logs = "" filtered_logs = ""
@ -248,6 +249,10 @@ class DockerHost(Host):
matches = re.findall(filter_regex, filtered_logs, re.IGNORECASE + re.MULTILINE) matches = re.findall(filter_regex, filtered_logs, re.IGNORECASE + re.MULTILINE)
found = list(matches) found = list(matches)
if exclude_filter:
found = [match for match in found if match != exclude_filter]
if found: if found:
filtered_logs += f"{container_name}:\n{os.linesep.join(found)}" filtered_logs += f"{container_name}:\n{os.linesep.join(found)}"

View file

@ -287,6 +287,7 @@ class Host(ABC):
since: Optional[datetime] = None, since: Optional[datetime] = None,
until: Optional[datetime] = None, until: Optional[datetime] = None,
unit: Optional[str] = None, unit: Optional[str] = None,
exclude_filter: Optional[str] = None,
) -> str: ) -> str:
"""Get logs from host filtered by regex. """Get logs from host filtered by regex.