Skip to main content
Glama

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
NameRequiredDescriptionDefault
startTimeNoStart time (Unix timestamp ms)
endTimeNoEnd time (Unix timestamp ms)
commandNoFilter by command name
minDurationNoMin duration in microseconds
limitNoMax entries to return
instanceIdNoOptional 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);
    }
  • 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,
        });

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/BetterDB-inc/monitor'

If you have feedback or need assistance with the MCP directory API, please join our Discord server