get_commandlog_history
Retrieve persisted command log entries from Valkey 8+ storage to investigate specific incidents using time range filtering and other criteria.
Instructions
Get persisted COMMANDLOG entries from storage (Valkey 8+ only). Supports time range filtering to investigate specific incidents. Returns empty with a note if COMMANDLOG is not supported on this instance.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| startTime | No | Start time (Unix timestamp ms) | |
| endTime | No | End time (Unix timestamp ms) | |
| command | No | Filter by command name | |
| minDuration | No | Min duration in microseconds | |
| limit | No | Max entries to return | |
| instanceId | No | Optional instance ID override |
Implementation Reference
- The actual service method that fetches command log entries from storage.
async getStoredCommandLog(options?: CommandLogQueryOptions): Promise<StoredCommandLogEntry[]> { return this.storage.getCommandLogEntries(options); } - packages/mcp/src/index.ts:454-464 (registration)The tool definition and registration for 'get_commandlog_history'.
server.tool( 'get_commandlog_history', 'Get persisted COMMANDLOG entries from storage (Valkey 8+ only). Supports time range filtering to investigate specific incidents. Returns empty with a note if COMMANDLOG is not supported on this instance.', { startTime: z.number().optional().describe('Start time (Unix timestamp ms)'), endTime: z.number().optional().describe('End time (Unix timestamp ms)'), command: z.string().optional().describe('Filter by command name'), minDuration: z.number().optional().describe('Min duration in microseconds'), limit: z.number().optional().describe('Max entries to return'), instanceId: z.string().optional().describe('Optional instance ID override'), }, - The API controller method that handles the request for the 'get_commandlog_history' tool.
async getCommandlogHistory( @Param('id', ValidateInstanceIdPipe) id: string, @Query('startTime') startTime?: string, @Query('endTime') endTime?: string, @Query('command') command?: string, @Query('minDuration') minDuration?: string, @Query('limit') limit?: string, ) { try { return await this.commandLogAnalyticsService.getStoredCommandLog({ startTime: msToSeconds(startTime), endTime: msToSeconds(endTime), command, minDuration: safeParseInt(minDuration), limit: safeLimit(limit, 100), offset: 0, connectionId: id, });