lablup / lablup/backend.ai

Implement Admin CLI for Error Log Query

Open
#7,763 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
670
Forks
183
Avg merge
17h 7m
Merged PRs (30d)
358

Description

## Motivation

Administrators need a way to query and analyze error logs for debugging and auditing purposes. A CLI tool provides quick access without requiring direct database queries or API calls.

- No easy way to query error logs from command line
- Superadmins need debugging tool for error analysis and correlation with audit logs

## Required Features

- Add new CLI command: `./backend.ai mgr error-log`
- Implement subcommand: `list` with options:
- `--request-id`: Filter by specific request ID
- `--severity`: Filter by severity level (critical, error, warning)
- `--user`: Filter by user ID
- `--since` / `--until`: Filter by date range
- `--limit`: Limit number of results
- `--format`: Output format (table, json)
- `--include-cleared`: Include cleared error logs
- Require superadmin authentication/authorization
- Display error message, severity, source, timestamp in readable format

## Impact

- New file: `src/ai/backend/manager/cli/error_log.py`
- `src/ai/backend/manager/cli/__init__.py`
- CLI entry point configuration

## Testing Scenarios

- Verify CLI command is accessible via `./backend.ai mgr error-log list`
- Verify superadmin authorization check
- Test various filter combinations (request-id, severity, date range)
- Test output formats (table and JSON)
- Verify non-superadmin users are rejected

JIRA Issue: BA-3740

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.