forked from TrueCloudLab/frostfs-testlib
[#136] Added exclude_filter
Added exclude_filter Signed-off-by: Mikhail Kadilov <m.kadilov@yadro.com>
This commit is contained in:
parent
dc6b0e407f
commit
17c1a4f14b
2 changed files with 6 additions and 0 deletions
|
@ -235,6 +235,7 @@ class DockerHost(Host):
|
|||
since: Optional[datetime] = None,
|
||||
until: Optional[datetime] = None,
|
||||
unit: Optional[str] = None,
|
||||
exclude_filter: Optional[str] = None,
|
||||
) -> str:
|
||||
client = self._get_docker_client()
|
||||
filtered_logs = ""
|
||||
|
@ -248,6 +249,10 @@ class DockerHost(Host):
|
|||
|
||||
matches = re.findall(filter_regex, filtered_logs, re.IGNORECASE + re.MULTILINE)
|
||||
found = list(matches)
|
||||
|
||||
if exclude_filter:
|
||||
found = [match for match in found if match != exclude_filter]
|
||||
|
||||
if found:
|
||||
filtered_logs += f"{container_name}:\n{os.linesep.join(found)}"
|
||||
|
||||
|
|
|
@ -287,6 +287,7 @@ class Host(ABC):
|
|||
since: Optional[datetime] = None,
|
||||
until: Optional[datetime] = None,
|
||||
unit: Optional[str] = None,
|
||||
exclude_filter: Optional[str] = None,
|
||||
) -> str:
|
||||
"""Get logs from host filtered by regex.
|
||||
|
||||
|
|
Loading…
Reference in a new issue