Skip to content

App Service Log Codebundle enhancements#513

Open
answersamir wants to merge 3 commits intorunwhen-contrib:mainfrom
answersamir:main
Open

App Service Log Codebundle enhancements#513
answersamir wants to merge 3 commits intorunwhen-contrib:mainfrom
answersamir:main

Conversation

@answersamir
Copy link
Contributor

🚀 Azure App Service Logs Optimization

📋 Problem Summary

Azure App Service codebundle was generating massive 5.8MB report.jsonl files that exceeded the 2.4MB UI rendering limit, causing reports to be download-only instead of viewable in the UI. Analysis revealed 99.3% of the file size came from verbose HTTP access logs with repetitive headers.


🔧 Key Changes

Enhanced Log Collection Script (appservice_logs_enhanced.sh)

  • 95-99% size reduction (5.8MB → <300KB)
  • Smart filtering removes noise, focuses on actionable errors
  • Size monitoring with automatic truncation and user guidance

New Configuration Variables

# Core Settings
LOG_LEVEL: ERROR|WARN|INFO|DEBUG|VERBOSE (default: INFO)
MAX_LOG_LINES: 100 (default)
MAX_TOTAL_SIZE: 500000 bytes (default)

# Enhanced Features
INCLUDE_DOCKER_LOGS: true (default)
INCLUDE_DEPLOYMENT_LOGS: true (default) 
INCLUDE_PERFORMANCE_TRACES: false (default)

Multi-Phase Log Sources

  • Phase 1: Application logs (always included) - filtered for errors/warnings
  • Phase 2A: Docker container logs - smart deduplication, restart analysis
  • Phase 2B: Deployment history - last 3 deployments with status
  • Phase 2C: Performance traces - slow requests (>30s), failed API calls

Performance Traces Simplification

  • Reliable filename parsing instead of complex regex
  • Full context display (90 chars) for better debugging
  • Simple extraction: grep -o '_[0-9]*s\.xml' for timing, grep -o '_[45][0-9][0-9]_' for status codes
  • Error categorization: CRITICAL (120s+), HIGH (60s+), MEDIUM

Sample Script Output

Downloaded logs to _rw_logs_app-ojcjiczjudu42-blog.zip
Azure App Service app-ojcjiczjudu42-blog Enhanced Logs (Level: INFO, Max Lines: 100):
Features: Docker[true] | Deployments[true] | Performance[true]

=== Application Logs ===
--- diagnostics-20250624.txt ---
2025-06-24 13:41:17.512 +00:00 [Error] Middleware: Failed to forward request to http://172.16.0.4:8080. Encountered a System.Net.Http.HttpRequestException exception after 3452.247ms with message: No route to host (172.16.0.4:8080). Check application logs to verify the application is properly handling HTTP traffic.
2025-06-24 13:55:53.429 +00:00 [Warning] Microsoft.AspNetCore.Hosting.Diagnostics: Overriding HTTP_PORTS '8080' and HTTPS_PORTS ''. Binding to values defined by URLS instead 'http://0.0.0.0:8181'.
2025-06-24 13:56:28.849 +00:00 [Error] Middleware: Failed to forward request to http://172.16.0.4:8080. Encountered a System.Net.Http.HttpRequestException exception after 3348.207ms with message: No route to host (172.16.0.4:8080). Check application logs to verify the application is properly handling HTTP traffic.
2025-06-24 14:15:37.964 +00:00 [Warning] Microsoft.AspNetCore.Hosting.Diagnostics: Overriding HTTP_PORTS '8080' and HTTPS_PORTS ''. Binding to values defined by URLS instead 'http://0.0.0.0:8181'.
2025-06-24 14:15:52.536 +00:00 [Error] Middleware: Failed to forward request to http://172.16.1.4:8080. Encountered a System.Net.Http.HttpRequestException exception after 3300.484ms with message: No route to host (172.16.1.4:8080). Check application logs to verify the application is properly handling HTTP traffic.
2025-06-24 14:15:56.420 +00:00 [Warning] Microsoft.AspNetCore.Hosting.Diagnostics: Overriding HTTP_PORTS '8080' and HTTPS_PORTS ''. Binding to values defined by URLS instead 'http://0.0.0.0:8181'.
2025-06-24 14:16:20.635 +00:00 [Error] Middleware: Failed to forward request to http://172.16.0.4:8080. Encountered a .....

--- diagnostics-20250625.txt ---
2025-06-25 01:41:12.535 +00:00 [Error] Middleware: Failed to forward request to http://172.16.1.4:8080. Encountered a System.Net.Http.HttpRequestException exception after 3358.451ms with message: No route to host (172.16.1.4:8080). Check application logs to verify the application is properly handling HTTP traffic.
2025-06-25 01:41:17.330 +00:00 [Warning] Microsoft.AspNetCore.Hosting.Diagnostics: Overriding HTTP_PORTS '8080' and HTTPS_PORTS ''. Binding to values defined by URLS instead 'http://0.0.0.0:8181'.
2025-06-25 01:41:43.961 +00:00 [Error] Middleware: Failed to forward request to http://172.16.0.4:8080. Encountered a System.Net.Http.HttpRequestException exception after 3274.876ms with message: No route to host (172.16.0.4:8080). Check application logs to verify the application is properly handling HTTP traffic.
2025-06-25 01:46:18.559 +00:00 [Warning] Microsoft.AspNetCore.Hosting.Diagnostics: Overriding HTTP_PORTS '8080' and HTTPS_PORTS ''. Binding to values defined by URLS instead 'http://0.0.0.0:8181'.
2025-06-25 01:46:45.394 +00:00 [Error] Middleware: Failed to forward request to http://172.16.0.4:8080. Encountered a System.Net.Http.HttpRequestException exception after 3497.932ms with message: No route to host (172.16.0.4:8080). Check application logs to verify the application is properly handling HTTP traffic.
2025-06-25 02:16:19.187 +00:00 [Warning] Microsoft.AspNetCore.Hosting.Diagnostics: Overriding HTTP_PORTS '8080' and HTTPS_PORTS ''. Binding to values defined by URLS instead 'http://0.0.0.0:8181'.
2025-06-25 02:16:44.773 +00:00 [Error] Middleware: Failed to forward request to http://172.16.0.4:8080. Encountered a .......

=== Docker Container Logs ===
--- 2025_06_24_lw0sdlwk000BN1_default_docker.log ---
2025-06-24T00:15:34.143833449Z sh: 1: next: not found
2025-06-24T00:50:31.899647085Z sh: 1: next: not found
2025-06-24T01:25:22.605535587Z sh: 1: next: not found
2025-06-24T02:00:36.228176700Z sh: 1: next: not found
2025-06-24T02:35:41.845493811Z sh: 1: next: not found
2025-06-24T00:15:00.623327993Z npm start
2025-06-24T00:15:34.013814403Z > blog@1.0.2 start
2025-06-24T00:15:34.013819603Z > next start
2025-06-24T00:15:00.623316893Z export PORT=8080
INFO: Container restarted 40 times with 00 error logs

--- 2025_06_24_lw1sdlwk000548_default_docker.log ---
2025-06-24T00:24:56.565766027Z sh: 1: next: not found
2025-06-24T01:05:05.649770507Z sh: 1: next: not found
2025-06-24T01:39:54.809582411Z sh: 1: next: not found
2025-06-24T02:14:58.510429987Z sh: 1: next: not found
2025-06-24T02:54:56.790558063Z sh: 1: next: not found
2025-06-24T00:24:40.204388382Z npm start
2025-06-24T00:24:56.456230585Z > blog@1.0.2 start
2025-06-24T00:24:56.456233986Z > next start
2025-06-24T00:24:40.204381147Z export PORT=8080
INFO: Container restarted 40 times with 00 error logs

--- 2025_06_24_lw1sdlwk00065D_default_docker.log ---
2025-06-24T00:00:31.358925083Z sh: 1: next: not found
2025-06-24T00:35:33.189274849Z sh: 1: next: not found
2025-06-24T01:10:29.709672165Z sh: 1: next: not found
2025-06-24T01:45:31.198453671Z sh: 1: next: not found
2025-06-24T02:20:30.616355920Z sh: 1: next: not found
2025-06-24T00:00:06.530517897Z npm start
2025-06-24T00:00:31.238431373Z > blog@1.0.2 start
2025-06-24T00:00:31.238436917Z > next start
2025-06-24T00:00:06.493548513Z export PORT=8080
INFO: Container restarted 41 times with 00 error logs

--- 2025_06_25_lw0sdlwk000BN1_default_docker.log ---
2025-06-25T00:26:46.250799721Z sh: 1: next: not found
2025-06-25T01:06:50.252212983Z sh: 1: next: not found
2025-06-25T01:41:38.188592582Z sh: 1: next: not found
2025-06-25T02:51:51.523200333Z sh: 1: next: not found
2025-06-25T03:26:58.187540319Z sh: 1: next: not found
2025-06-25T00:26:18.563390789Z npm start
2025-06-25T00:26:46.118172330Z > blog@1.0.2 start
2025-06-25T00:26:46.118177930Z > next start
2025-06-25T00:26:18.563379789Z export PORT=8080
INFO: Container restarted 19 times with 00 error logs

--- 2025_06_25_lw1sdlwk000548_default_docker.log ---
2025-06-25T00:31:05.100233634Z sh: 1: next: not found
2025-06-25T01:06:01.748559911Z sh: 1: next: not found
2025-06-25T01:41:07.373505299Z sh: 1: next: not found
2025-06-25T02:21:06.648089901Z sh: 1: next: not found
2025-06-25T03:01:30.054475893Z sh: 1: next: not found
2025-06-25T00:30:47.475485881Z npm start
2025-06-25T00:31:05.010374807Z > blog@1.0.2 start
2025-06-25T00:31:05.010378602Z > next start
2025-06-25T00:30:47.475478424Z export PORT=8080
INFO: Container restarted 20 times with 00 error logs

--- 2025_06_25_lw1sdlwk00065D_default_docker.log ---
2025-06-25T00:31:34.310458556Z sh: 1: next: not found
2025-06-25T01:06:32.895815935Z sh: 1: next: not found
2025-06-25T01:46:36.567690620Z sh: 1: next: not found
2025-06-25T02:21:43.495502701Z sh: 1: next: not found
2025-06-25T02:56:42.439595751Z sh: 1: next: not found
2025-06-25T00:31:14.414390937Z npm start
2025-06-25T00:31:34.164540130Z > blog@1.0.2 start
2025-06-25T00:31:34.164546645Z > next start
2025-06-25T00:31:14.413706930Z export PORT=8080
INFO: Container restarted 20 times with 00 error logs

--- 2025_06_24_lw0sdlwk000BN1_default_docker.log ---
2025-06-24T00:15:34.143833449Z sh: 1: next: not found
2025-06-24T00:50:31.899647085Z sh: 1: next: not found
2025-06-24T01:25:22.605535587Z sh: 1: next: not found
2025-06-24T02:00:36.228176700Z sh: 1: next: not found
2025-06-24T02:35:41.845493811Z sh: 1: next: not found
2025-06-24T00:15:00.623327993Z npm start
2025-06-24T00:15:34.013814403Z > blog@1.0.2 start
2025-06-24T00:15:34.013819603Z > next start
2025-06-24T00:15:00.623316893Z export PORT=8080
INFO: Container restarted 40 times with 00 error logs

--- 2025_06_24_lw0sdlwk000BN1_docker.log ---
2025-06-24T06:10:32.386Z ERROR - Container app-ojcjiczjudu42-blog_0_51a04446 for site app-ojcjiczjudu42-blog has exited, failing site start
2025-06-24T06:10:36.730Z ERROR - Container app-ojcjiczjudu42-blog_0_51a04446 didn't respond to HTTP pings on port: 8080. Failing site start. See container logs for debugging.
2025-06-24T06:10:36.855Z INFO - Stopping site app-ojcjiczjudu42-blog because it failed during startup.
2025-06-24T06:45:39.443Z ERROR - Container app-ojcjiczjudu42-blog_0_0a95ab2f for site app-ojcjiczjudu42-blog has exited, failing site start
2025-06-24T06:45:45.780Z ERROR - Container app-ojcjiczjudu42-blog_0_0a95ab2f didn't respond to HTTP pings on port: 8080. Failing site start. See container logs for debugging.
2025-06-24T06:10:32.386Z ERROR - Container app-ojcjiczjudu42-blog_0_51a04446 for site app-ojcjiczjudu42-blog has exited, failing site start
2025-06-24T06:10:36.730Z ERROR - Container app-ojcjiczjudu42-blog_0_51a04446 didn't respond to HTTP pings on port: 8080. Failing site start. See container logs for debugging.
2025-06-24T06:10:36.855Z INFO - Stopping site app-ojcjiczjudu42-blog because it failed during startup.

--- 2025_06_24_lw0sdlwk000BN1_easyauth_docker.log ---

--- 2025_06_24_lw0sdlwk000BN1_msi_docker.log ---

--- 2025_06_24_lw1sdlwk000548_default_docker.log ---
2025-06-24T00:24:56.565766027Z sh: 1: next: not found
2025-06-24T01:05:05.649770507Z sh: 1: next: not found
2025-06-24T01:39:54.809582411Z sh: 1: next: not found
2025-06-24T02:14:58.510429987Z sh: 1: next: not found
2025-06-24T02:54:56.790558063Z sh: 1: next: not found
2025-06-24T00:24:40.204388382Z npm start
2025-06-24T00:24:56.456230585Z > blog@1.0.2 start
2025-06-24T00:24:56.456233986Z > next start
2025-06-24T00:24:40.204381147Z export PORT=8080
INFO: Container restarted 40 times with 00 error logs

--- 2025_06_24_lw1sdlwk000548_docker.log ---
2025-06-24T01:39:55.994Z ERROR - Container app-ojcjiczjudu42-blog_0_b2dc033d for site app-ojcjiczjudu42-blog has exited, failing site start
2025-06-24T01:40:00.333Z ERROR - Container app-ojcjiczjudu42-blog_0_b2dc033d didn't respond to HTTP pings on port: 8080. Failing site start. See container logs for debugging.
2025-06-24T01:40:00.416Z INFO - Stopping site app-ojcjiczjudu42-blog because it failed during startup.
2025-06-24T02:14:59.634Z ERROR - Container app-ojcjiczjudu42-blog_0_a2de7254 for site app-ojcjiczjudu42-blog has exited, failing site start
2025-06-24T02:15:05.859Z ERROR - Container app-ojcjiczjudu42-blog_0_a2de7254 didn't respond to HTTP pings on port: 8080. Failing site start. See container logs for debugging.
2025-06-24T01:39:55.994Z ERROR - Container app-ojcjiczjudu42-blog_0_b2dc033d for site app-ojcjiczjudu42-blog has exited, failing site start
2025-06-24T01:40:00.333Z ERROR - Container app-ojcjiczjudu42-blog_0_b2dc033d didn't respond to HTTP pings on port: 8080. Failing site start. See container logs for debugging.
2025-06-24T01:40:00.416Z INFO - Stopping site app-ojcjiczjudu42-blog because it failed during startup.

--- 2025_06_24_lw1sdlwk000548_easyauth_docker.log ---

--- 2025_06_24_lw1sdlwk000548_msi_docker.log ---

--- 2025_06_24_lw1sdlwk00065D_default_docker.log ---
2025-06-24T00:00:31.358925083Z sh: 1: next: not found
2025-06-24T00:35:33.189274849Z sh: 1: next: not found
2025-06-24T01:10:29.709672165Z sh: 1: next: not found
2025-06-24T01:45:31.198453671Z sh: 1: next: not found
2025-06-24T02:20:30.616355920Z sh: 1: next: not found
2025-06-24T00:00:06.530517897Z npm start
2025-06-24T00:00:31.238431373Z > blog@1.0.2 start
2025-06-24T00:00:31.238436917Z > next start
2025-06-24T00:00:06.493548513Z export PORT=8080
INFO: Container restarted 41 times with 00 error logs

--- 2025_06_24_lw1sdlwk00065D_docker.log ---
2025-06-24T06:30:51.125Z ERROR - Container app-ojcjiczjudu42-blog_0_e96901fd for site app-ojcjiczjudu42-blog has exited, failing site start
2025-06-24T06:30:56.280Z ERROR - Container app-ojcjiczjudu42-blog_0_e96901fd didn't respond to HTTP pings on port: 8080. Failing site start. See container logs for debugging.
2025-06-24T06:30:58.552Z INFO - Stopping site app-ojcjiczjudu42-blog because it failed during startup.
2025-06-24T07:05:53.047Z ERROR - Container app-ojcjiczjudu42-blog_0_ca3b0511 for site app-ojcjiczjudu42-blog has exited, failing site start
2025-06-24T07:05:57.486Z ERROR - Container app-ojcjiczjudu42-blog_0_ca3b0511 didn't respond to HTTP pings on port: 8080. Failing site start. See container logs for debugging.
2025-06-24T06:30:51.125Z ERROR - Container app-ojcjiczjudu42-blog_0_e96901fd for site app-ojcjiczjudu42-blog has exited, failing site start
2025-06-24T06:30:56.280Z ERROR - Container app-ojcjiczjudu42-blog_0_e96901fd didn't respond to HTTP pings on port: 8080. Failing site start. See container logs for debugging.
2025-06-24T06:30:58.552Z INFO - Stopping site app-ojcjiczjudu42-blog because it failed during startup.

--- 2025_06_24_lw1sdlwk00065D_easyauth_docker.log ---

--- 2025_06_24_lw1sdlwk00065D_msi_docker.log ---

--- 2025_06_25_lw0sdlwk000BN1_default_docker.log ---
2025-06-25T00:26:46.250799721Z sh: 1: next: not found
2025-06-25T01:06:50.252212983Z sh: 1: next: not found
2025-06-25T01:41:38.188592582Z sh: 1: next: not found
2025-06-25T02:51:51.523200333Z sh: 1: next: not found
2025-06-25T03:26:58.187540319Z sh: 1: next: not found
2025-06-25T00:26:18.563390789Z npm start
2025-06-25T00:26:46.118172330Z > blog@1.0.2 start
2025-06-25T00:26:46.118177930Z > next start
2025-06-25T00:26:18.563379789Z export PORT=8080
INFO: Container restarted 19 times with 00 error logs

--- 2025_06_25_lw0sdlwk000BN1_docker.log ---
2025-06-25T06:37:31.575Z ERROR - Container app-ojcjiczjudu42-blog_0_275f8135 for site app-ojcjiczjudu42-blog has exited, failing site start
2025-06-25T06:37:39.547Z ERROR - Container app-ojcjiczjudu42-blog_0_275f8135 didn't respond to HTTP pings on port: 8080. Failing site start. See container logs for debugging.
2025-06-25T06:37:39.932Z INFO - Stopping site app-ojcjiczjudu42-blog because it failed during startup.
2025-06-25T07:11:53.580Z ERROR - Container app-ojcjiczjudu42-blog_0_07d8d671 for site app-ojcjiczjudu42-blog has exited, failing site start
2025-06-25T07:11:58.993Z ERROR - Container app-ojcjiczjudu42-blog_0_07d8d671 didn't respond to HTTP pings on port: 8080. Failing site start. See container logs for debugging.
2025-06-25T06:37:31.575Z ERROR - Container app-ojcjiczjudu42-blog_0_275f8135 for site app-ojcjiczjudu42-blog has exited, failing site start
2025-06-25T06:37:39.547Z ERROR - Container app-ojcjiczjudu42-blog_0_275f8135 didn't respond to HTTP pings on port: 8080. Failing site start. See container logs for debugging.
2025-06-25T06:37:39.932Z INFO - Stopping site app-ojcjiczjudu42-blog because it failed during startup.

--- 2025_06_25_lw0sdlwk000BN1_easyauth_docker.log ---

--- 2025_06_25_lw0sdlwk000BN1_msi_docker.log ---

--- 2025_06_25_lw1sdlwk000548_default_docker.log ---
2025-06-25T00:31:05.100233634Z sh: 1: next: not found
2025-06-25T01:06:01.748559911Z sh: 1: next: not found
2025-06-25T01:41:07.373505299Z sh: 1: next: not found
2025-06-25T02:21:06.648089901Z sh: 1: next: not found
2025-06-25T03:01:30.054475893Z sh: 1: next: not found
2025-06-25T00:30:47.475485881Z npm start
2025-06-25T00:31:05.010374807Z > blog@1.0.2 start
2025-06-25T00:31:05.010378602Z > next start
2025-06-25T00:30:47.475478424Z export PORT=8080
INFO: Container restarted 20 times with 00 error logs

--- 2025_06_25_lw1sdlwk000548_docker.log ---
2025-06-25T01:41:08.301Z ERROR - Container app-ojcjiczjudu42-blog_0_193196dc for site app-ojcjiczjudu42-blog has exited, failing site start
2025-06-25T01:41:12.701Z ERROR - Container app-ojcjiczjudu42-blog_0_193196dc didn't respond to HTTP pings on port: 8080. Failing site start. See container logs for debugging.
2025-06-25T01:41:12.732Z INFO - Stopping site app-ojcjiczjudu42-blog because it failed during startup.
2025-06-25T02:21:07.472Z ERROR - Container app-ojcjiczjudu42-blog_0_e7020677 for site app-ojcjiczjudu42-blog has exited, failing site start
2025-06-25T02:21:12.350Z ERROR - Container app-ojcjiczjudu42-blog_0_e7020677 didn't respond to HTTP pings on port: 8080. Failing site start. See container logs for debugging.
2025-06-25T01:41:08.301Z ERROR - Container app-ojcjiczjudu42-blog_0_193196dc for site app-ojcjiczjudu42-blog has exited, failing site start
2025-06-25T01:41:12.701Z ERROR - Container app-ojcjiczjudu42-blog_0_193196dc didn't respond to HTTP pings on port: 8080. Failing site start. See container logs for debugging.
2025-06-25T01:41:12.732Z INFO - Stopping site app-ojcjiczjudu42-blog because it failed during startup.

--- 2025_06_25_lw1sdlwk000548_easyauth_docker.log ---

--- 2025_06_25_lw1sdlwk000548_msi_docker.log ---

--- 2025_06_25_lw1sdlwk00065D_default_docker.log ---
2025-06-25T00:31:34.310458556Z sh: 1: next: not found
2025-06-25T01:06:32.895815935Z sh: 1: next: not found
2025-06-25T01:46:36.567690620Z sh: 1: next: not found
2025-06-25T02:21:43.495502701Z sh: 1: next: not found
2025-06-25T02:56:42.439595751Z sh: 1: next: not found
2025-06-25T00:31:14.414390937Z npm start
2025-06-25T00:31:34.164540130Z > blog@1.0.2 start
2025-06-25T00:31:34.164546645Z > next start
2025-06-25T00:31:14.413706930Z export PORT=8080
INFO: Container restarted 20 times with 00 error logs

--- 2025_06_25_lw1sdlwk00065D_docker.log ---
2025-06-25T06:41:45.687Z ERROR - Container app-ojcjiczjudu42-blog_0_90a8c404 for site app-ojcjiczjudu42-blog has exited, failing site start
2025-06-25T06:41:50.047Z ERROR - Container app-ojcjiczjudu42-blog_0_90a8c404 didn't respond to HTTP pings on port: 8080. Failing site start. See container logs for debugging.
2025-06-25T06:41:50.211Z INFO - Stopping site app-ojcjiczjudu42-blog because it failed during startup.
2025-06-25T07:16:51.215Z ERROR - Container app-ojcjiczjudu42-blog_0_cb852838 for site app-ojcjiczjudu42-blog has exited, failing site start
2025-06-25T07:16:55.897Z ERROR - Container app-ojcjiczjudu42-blog_0_cb852838 didn't respond to HTTP pings on port: 8080. Failing site start. See container logs for debugging.
2025-06-25T06:41:45.687Z ERROR - Container app-ojcjiczjudu42-blog_0_90a8c404 for site app-ojcjiczjudu42-blog has exited, failing site start
2025-06-25T06:41:50.047Z ERROR - Container app-ojcjiczjudu42-blog_0_90a8c404 didn't respond to HTTP pings on port: 8080. Failing site start. See container logs for debugging.
2025-06-25T06:41:50.211Z INFO - Stopping site app-ojcjiczjudu42-blog because it failed during startup.

--- 2025_06_25_lw1sdlwk00065D_easyauth_docker.log ---

--- 2025_06_25_lw1sdlwk00065D_msi_docker.log ---

=== Recent Deployments (Last 3) ===
--- Deployment: fff10754... ---
2025-06-07T02:28:48.2110629Z,Deployment successful. deployer = Push-Deployer deploymentPath = ZipDeploy. Run from package.,077d1261-e301-4471-ab2d-dccdb6ff078e,0

--- Deployment: 40ae5a41... ---
2025-06-06T21:00:44.1458183Z,Deployment successful. deployer = Push-Deployer deploymentPath = ZipDeploy. Run from package.,34180703-bef5-4f63-8b75-1730919f817a,0

--- Deployment: 737c220b... ---
2025-06-07T00:42:56.6876554Z,Deployment successful. deployer = Push-Deployer deploymentPath = ZipDeploy. Run from package.,ed4f3ae4-991d-4501-ab12-a81d6af48643,0

=== Performance Issues ===
⚠️ 🟡 MEDIUM Slow Request (37s): 2025-06-25T11-17-22_18025e_068_GET_dump_200_37s.xml
⚠️ 🟡 MEDIUM Slow Request (33s): 2025-06-25T10-10-30_f9df0d_052_GET_dump_200_33s.xml
⚠️ 🔴 CRITICAL Slow Request (143s): 2025-06-25T11-06-50_18025e_064_GET_dump_200_143s.xml
⚠️ 🟡 MEDIUM Slow Request (40s): 2025-06-21T10-44-30_f9df0d_753_GET_dump_200_40s.xml
⚠️ 🟠 HIGH Slow Request (72s): 2025-06-25T04-46-00_18025e_991_GET_dump_200_72s.xml
⏳ Pending Request: 2025-06-25T12-28-37_18025e_076_GET_dump_pending.xml
⏳ Pending Request: 2025-06-07T02-39-39_f9df0d_005_Background_POST_api-zipdeploy_pending.xml
❌ 🟡 NOT FOUND (HTTP 404): 2025-06-19T21-31-38_f9df0d_404_GET_api-deployments-5d2aba3f-cd26-4874-a88b-2c5fbbe8260b-lo
❌ 🔴 SERVER ERROR (HTTP 500): 2025-06-19T21-16-04_c94474_500_GET_api-deployments-5d2aba3f-cd26-4874-a88b-2c5fbbe8260b-lo
❌ 🔴 SERVER ERROR (HTTP 500): 2025-06-24T04-09-03_f9df0d_500_GET_api-deployments-5d2aba3f-cd26-4874-a88b-2c5fbbe8260b-lo

📊 Enhanced Logs Summary

Output size: 67015 bytes (Limit: 500000 bytes)
Log level: INFO
Features enabled:

  • Application Logs: ✅ (always included)
  • Docker Logs: ✅
  • Deployment History: ✅
  • Performance Traces: ✅

🔍 For complete logs, visit: https://portal.azure.com and navigate to your App Service > Logs

…tion and verbosity control. Update README with log level configuration details and examples. Add cursor file to .gitignore.
…atures for Docker logs, deployment history, and performance traces. Update README and runbook to reflect changes in verbosity control and configuration examples.
- Keep enhanced logs functionality with multiple phases (Docker, deployment, performance traces)
- Add AZURE_RESOURCE_SUBSCRIPTION_ID variable support from remote changes
- Merge log collection improvements while maintaining optimization features
- Resolve conflicts by combining both enhancement sets
Copilot AI review requested due to automatic review settings June 25, 2025 12:30
@answersamir answersamir requested a review from a team as a code owner June 25, 2025 12:30
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enhances the Azure App Service log codebundle by optimizing log collection and filtering to dramatically reduce report sizes while preserving essential diagnostic information. Key changes include updates to the runbook with new configuration variables, a completely revamped enhanced log collection script with size monitoring and smart filtering, and corresponding documentation updates in the README.

Reviewed Changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 1 comment.

File Description
codebundles/azure-appservice-webapp-health/runbook.robot Updated to import new configuration variables for enhanced log settings.
codebundles/azure-appservice-webapp-health/appservice_logs_enhanced.sh New script version with phased log collection, filtering, and size checks.
codebundles/azure-appservice-webapp-health/appservice_logs.sh Adjusted log download and display script to align with the enhanced approach.
codebundles/azure-appservice-webapp-health/README.md Expanded documentation covering new log levels and configuration options.
Comments suppressed due to low confidence (1)

codebundles/azure-appservice-webapp-health/runbook.robot:405

  • Consider clarifying in the documentation that the boolean configuration variables (e.g. INCLUDE_DOCKER_LOGS, INCLUDE_DEPLOYMENT_LOGS, INCLUDE_PERFORMANCE_TRACES) expect values 'true' or 'false'. This can help avoid misconfiguration in environments with strict type or regex expectations.
    ${LOG_LEVEL}=    RW.Core.Import User Variable    LOG_LEVEL

grep -E 'export PORT=|NODE_PATH=' "$docker_log" | head -2
)
# Container restart summary separately
restart_count=$(grep -c 'A P P S E R V I C E O N L I N U X' "$docker_log" 2>/dev/null || echo "0")
Copy link

Copilot AI Jun 25, 2025

Choose a reason for hiding this comment

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

The current approach for determining container restart counts relies on a log message with a fixed spacing ('A P P S E R V I C E O N L I N U X'), which might be brittle if log formats change. Consider using a more robust method or configurable pattern to detect container restart events.

Suggested change
restart_count=$(grep -c 'A P P S E R V I C E O N L I N U X' "$docker_log" 2>/dev/null || echo "0")
restart_count=$(grep -iE "$RESTART_LOG_PATTERN" "$docker_log" | wc -l 2>/dev/null || echo "0")

Copilot uses AI. Check for mistakes.
echo "Failed to set subscription within 10 seconds."
exit 1
fi
TEMP_DIR="/tmp/_temp_logs_$$"
Copy link
Contributor

@stewartshea stewartshea Jun 28, 2025

Choose a reason for hiding this comment

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

@answersamir this could possibly cause issues during runtime execution; we have a few paths that apply to our runtime. Technically it should work, but we run the risk of not forcing a cleanup, growing a temp filesystem. In most use cases, we prefer to create the temp directories under the existing working dir, which is typically $CODEBUNDLE_TEMP_DIR, which gets cleaned up when the execution ends.

Easiest path is likely
TEMP_DIR="./_temp_logs_$$"

We shouldn't then need to clean up any other file system permissions either .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants