RAG Service
← Back to Documentation Center

Logs

Diagnostics view for application logs pulled from Azure App Service (Kudu). Offers a raw text feed for automation and a UI for quick inspection.

Endpoints

  • GET /logs/ui — Web UI with date selector, auto-refresh, colorized levels, and parsed entries
  • GET /logs/raw — Raw log text for AJAX/CLI; supports date selection via query string

How it works

  • The server calls Azure CLI to fetch Kudu publishing credentials: az webapp deployment list-publishing-credentials.
  • Using those credentials, it queries the Kudu VFS API at https://<app>.scm.azurewebsites.net/api/vfs/LogFiles/ to list log files, then reads the selected *_default_docker.log file.
  • UI features:
    • Date dropdown (maps to the log file’s YYYYMMDD key)
    • Auto-refresh every 10s (pauses on hover)
    • Colorized timestamps and log levels; basic ANSI code rendering
    • Parsed entries panel that filters interesting lines (e.g., RAG steps, prompts, metadata markers)

Query parameters

  • date (string, optional, YYYYMMDD): selects the log by date. Defaults to today if available, else latest.

Raw output example

2025-09-09T12:34:56Z INFO Starting app...
2025-09-09T12:35:01Z ERROR Something failed

Parsed entries (UI)

The UI highlights lines matching these patterns (can be edited in code): - WARNING:root:AzureSearchFetcher - Step 1:, Step 2:, Step 3: - [RagOrchestrator] - ^Question:, ^Answer: - Model response:, Extracting metadata, Generated prompt/messages, Gathered data - <!-- BACKEND_LOG_START --> and <!-- BACKEND_LOG_END -->

Configuration

  • App Service name and resource group are currently hardcoded in the endpoint implementation:
    • app_name = "aichat-dev-t55fh-chat"
    • resource_group = "Dev-RCV-Chat"
  • Adjust these in rag_api_core/endpoints/v2/logs.py or wire them to your config.
  • Templates are in rag_api_core/templates/v2/logs.html.

Authentication & prerequisites

  • Requires Azure CLI on the server and an authenticated session with permission to read publishing credentials.
  • Publishing credentials are sensitive. Restrict access to the logs routes and avoid exposing raw credentials.

Errors & troubleshooting

  • 500 when listing or fetching files: ensure Azure CLI is installed, you are logged in, and the app name/resource group are correct.
  • Empty log view: confirm that *_default_docker.log files exist under Kudu LogFiles and that you’re selecting a valid date.
  • Slow or partial loads: Kudu responses are best-effort; try smaller fetch intervals or manual refresh.

Tips

  • Use /logs/raw?date=YYYYMMDD for lightweight polling or scripting.
  • Use /logs/ui for fast human-friendly inspection with highlighting and filters.