Skip to content

Commit

Permalink
update error fetch script
Browse files Browse the repository at this point in the history
Signed-off-by: bvolovat <borisv@armosec.io>
  • Loading branch information
bvolovat committed Feb 16, 2025
1 parent 82e7115 commit 7a09eec
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
10 changes: 6 additions & 4 deletions check_logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@

# Use the same output directory as other scripts
OUTPUT_DIR = os.getenv("OUTPUT_DIR", "/workspace/logs")
os.makedirs(OUTPUT_DIR, exist_ok=True)
LOGS_DIR = os.path.join(OUTPUT_DIR, "logs")
os.makedirs(LOGS_DIR, exist_ok=True) # Ensure logs directory exists

ERROR_KEYWORDS = "error|fail|panic"

Expand Down Expand Up @@ -35,11 +36,12 @@ def main():

combined_logs = "\n".join(filter(None, [logs_current, logs_previous])) # Merge if both exist

if combined_logs: # Only create a file if errors are found
pod_log_file = os.path.join(OUTPUT_DIR, f"{pod}_errors.log")
if combined_logs: # Only create a file if errors exist
pod_log_file = os.path.join(LOGS_DIR, f"{pod}.log") # Save as pod_name.log
with open(pod_log_file, "w") as log_file:
log_file.write(combined_logs + "\n")
print(f"⚠️ Errors detected in {pod}! Log saved to {pod_log_file}")

print(f"Errors detected in {pod}! Log saved to {pod_log_file}")
else:
print(f"No errors found in {pod}.")

Expand Down
1 change: 1 addition & 0 deletions performance.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@ def get_node_agent_tag_from_git():
return None
except Exception as e:
print(f"Error fetching values.yaml from GitHub: {e}")
exit(1)
return None

# Step 3: Wait for the cluster to be ready
Expand Down

0 comments on commit 7a09eec

Please sign in to comment.