Skip to content

Commit

Permalink
Capture logcollector pattern only once (Azure#3194)
Browse files Browse the repository at this point in the history
* Capture logcollector pattern only once

* Add comment
  • Loading branch information
maddieford authored Aug 27, 2024
1 parent 8dbb016 commit 04490fb
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tests_e2e/tests/log_collector/log_collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ def run(self):

# Get any agent logs between log collector start and finish
try:
output = ssh_client.run_command(
"sed -n " +
"'/INFO CollectLogsHandler ExtHandler Starting log collection/, /INFO CollectLogsHandler ExtHandler Successfully uploaded logs/p' " +
"/var/log/waagent.log").rstrip().splitlines()
# We match the first full log collector run in the agent log (this test just needs to validate any full log collector run, does not matter if it's the first or last)
lc_start_pattern = "INFO CollectLogsHandler ExtHandler Starting log collection"
lc_end_pattern = "INFO CollectLogsHandler ExtHandler Successfully uploaded logs"
output = ssh_client.run_command("sed -n '/{0}/,/{1}/{{p;/{1}/q}}' /var/log/waagent.log".format(lc_start_pattern, lc_end_pattern)).rstrip().splitlines()
except Exception as e:
raise Exception("Unable to get log collector logs from waagent.log: {0}".format(e))

Expand Down

0 comments on commit 04490fb

Please sign in to comment.