Implement Admin CLI for Audit Log Query
- 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 phase history data for debugging and auditing purposes. A CLI tool provides quick access without requiring direct database queries.
- No easy way to query phase_history from audit logs
- Superadmins need debugging tool for complex operation analysis
## Required Features
- Add new CLI command group: `./backend.ai mgr audit-log`
- Implement subcommand: `phase-history` with options:
- `--request-id`: Filter by specific request ID
- `--action-id`: Filter by specific action ID
- `--since`: Filter by date range
- `--limit`: Limit number of results
- `--format`: Output format (table, json)
- Require superadmin authentication/authorization
- Display phase history in readable format with timing information
## Impact
- New file: `src/ai/backend/manager/cli/audit_log.py`
- `src/ai/backend/manager/cli/__init__.py`
- CLI entry point configuration
## Testing Scenarios
- Verify CLI command is accessible via `./backend.ai mgr audit-log phase-history`
- Verify superadmin authorization check
- Test various filter combinations
- Test output formats (table and JSON)
- Verify non-superadmin users are rejected
JIRA Issue: BA-3732
Contributor guide
Assessment
This issue has not been assessed yet.