Skip to content

Get debug file statistics

GET
/api/system/debug/stats

Get comprehensive statistics about debug files.

Analyzes all debug files in the logs directory and provides detailed statistics including file counts, sizes, age analysis, and categorization by file type (crashdata vs dumplog).

Returns:

  • total_files: Total number of debug files found
  • total_size_mb: Total disk space used by debug files in megabytes
  • crashdata_files: Count of crashdata-* files
  • dumplog_files: Count of dumplog-* files
  • oldest_file: ISO timestamp of the oldest debug file (or null)
  • newest_file: ISO timestamp of the newest debug file (or null)
  • files_older_than_week: Count of files older than 7 days

File Type Categories:

  • crashdata-*: Crash dump data files with full error context
  • dumplog-*: Dump log files with system state information
  • .dump: Generic dump files
  • .crash: Generic crash files

Age Analysis:

  • Parses timestamps from filenames for accurate age tracking
  • Falls back to file modification time if timestamp parsing fails
  • Identifies files older than 7 days for cleanup recommendations

Raises:

  • HTTPException (500): If statistics collection fails

Example Response:

{
    "total_files": 42,
    "total_size_mb": 125.67,
    "crashdata_files": 28,
    "dumplog_files": 14,
    "oldest_file": "2024-12-11T10:30:00Z",
    "newest_file": "2024-12-18T15:45:00Z",
    "files_older_than_week": 15
}

Successful Response

DebugStatsResponse

Debug file statistics response.

Provides comprehensive debug file statistics including total file counts, total size, crash dump counts, old file counts, and file age information. Used by debug file management endpoints to report debug file inventory.

Fields:

  • total_files: Total number of debug files (required, integer)
  • total_size_mb: Total size of all debug files in megabytes (required, float)
  • crash_dumps: Number of crash dump files (required, integer)
  • old_files: Number of files older than retention period (required, integer)
  • oldest_file: Filename of oldest debug file (optional)
  • newest_file: Filename of newest debug file (optional)

Usage: GET /api/debug/stats returns this response model with debug file statistics for cleanup planning and monitoring.

JSON Example:

{
  "totalFiles": 25,
  "totalSizeMb": 150.5,
  "crashDumps": 15,
  "oldFiles": 10,
  "oldestFile": "crashdata-2024-12-01T10-30-00-000Z.json",
  "newestFile": "crashdata-2025-01-31T10-30-00-000Z.json"
}
object
totalFiles
required
Totalfiles

Total number of debug files

integer
totalSizeMb
required
Totalsizemb

Total size in MB

number
crashDumps
required
Crashdumps

Number of crash dump files

integer
oldFiles
required
Oldfiles

Number of old files

integer
oldestFile
Any of:
string
newestFile
Any of:
string