Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore logcollector fetch failure if it recovers #2906

Merged
merged 2 commits into from
Aug 29, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions tests_e2e/tests/lib/agent_log.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,15 @@ def get_errors(self) -> List[AgentLogRecord]:
{
'message': r"Microsoft.Azure.Security.Monitoring.AzureSecurityLinuxAgent.*op=Install.*Non-zero exit code: 56,",
},

#
# Ignore LogCollector failure to fetch vmSettings if it recovers
#
# 2023-08-27T08:13:42.520557Z WARNING MainThread LogCollector Fetch failed: [HttpError] [HTTP Failed] GET https://md-hdd-tkst3125n3x0.blob.core.chinacloudapi.cn/$system/lisa-WALinuxAgent-20230827-080144-029-e0-n0.cb9a406f-584b-4702-98bb-41a3ad5e334f.vmSettings -- IOError timed out -- 6 attempts made
#
{
'message': r"Fetch failed:.*GET.*vmSettings.*timed out",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the message should be specific to the log collector

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is prefix not help here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yup, missed that, thanks

'if': lambda r: r.prefix == 'LogCollector' and self.agent_log_contains("LogCollector Log collection successfully completed", after_timestamp=r.timestamp)
},
]

def is_error(r: AgentLogRecord) -> bool:
Expand Down Expand Up @@ -381,14 +389,16 @@ def is_error(r: AgentLogRecord) -> bool:

return errors

def agent_log_contains(self, data: str):
def agent_log_contains(self, data: str, after_timestamp: str = datetime.min):
"""
This function looks for the specified test data string in the WALinuxAgent logs and returns if found or not.
:param data: The string to look for in the agent logs
:return: True if test data string found in the agent log and False if not.
:param after_timestamp: A timestamp
appears after this timestamp
:return: True if test data string found in the agent log after after_timestamp and False if not.
"""
for record in self.read():
if data in record.text:
if data in record.text and record.timestamp > after_timestamp:
return True
return False

Expand Down
Loading