Returns the specified command log’s entries.
COMMANDLOG
GET
count <slow |
large-request | large-reply>
The COMMANDLOG GET
command returns entries from the
command log of specified type in chronological order.
The Command Log system is used to record commands that consume significant resources during server operation, including CPU, memory, and network bandwidth. These commands and the data they access may lead to abnormal instance operations, the command log can help users quickly and intuitively locate issues.
Currently, three types of command logs are supported:
SLOW: Logs commands that exceed a specified execution time. This excludes time spent on I/O operations like client communication and focuses solely on the command’s processing time, where the main thread is blocked.
LARGE-REQUEST: Logs commands with requests exceeding a defined size. This helps identify potentially problematic commands that send excessive data to the server.
LARGE-REPLY: Logs commands that generate replies exceeding a defined size. This helps identify commands that return unusually large amounts of data, which may impact network performance or client processing.
Each log type has two key parameters: 1. A threshold value that
determines when a command is logged. This threshold is specific to the
type of log (e.g., execution time, request size, or reply size). A
negative value disables logging. A value of 0 logs all commands. 2. A
maximum length that specifies the number of entries to retain in the
log. Increasing the length allows more entries to be stored but consumes
additional memory. To clear all entries for a specific log type and
reclaim memory, use the COMMANDLOG RESET
subcommand
followed by the log type.
See the details of configurations in valkey.conf.
Each entry from the specific type of command log is comprised of the following six values:
CLIENT SETNAME
command.The entry’s unique ID can be used in order to avoid processing
command log entries multiple times (for instance you may have a script
sending you an email alert for every new command log entry). The ID is
never reset in the course of the Valkey server execution, even after
COMMANDLOG RESET
was executed. In order to reset the ID a
server restart is needed.
O(N) where N is the number of entries returned
@admin @dangerous @slow
ACL, ACL CAT, ACL DELUSER, ACL DRYRUN, ACL GENPASS, ACL GETUSER, ACL HELP, ACL LIST, ACL LOAD, ACL LOG, ACL SAVE, ACL SETUSER, ACL USERS, ACL WHOAMI, BGREWRITEAOF, BGSAVE, COMMAND, COMMAND COUNT, COMMAND DOCS, COMMAND GETKEYS, COMMAND GETKEYSANDFLAGS, COMMAND HELP, COMMAND INFO, COMMAND LIST, COMMANDLOG, COMMANDLOG HELP, COMMANDLOG LEN, COMMANDLOG RESET, CONFIG, CONFIG GET, CONFIG HELP, CONFIG RESETSTAT, CONFIG REWRITE, CONFIG SET, DBSIZE, DEBUG, FAILOVER, FLUSHALL, FLUSHDB, INFO, LASTSAVE, LATENCY, LATENCY DOCTOR, LATENCY GRAPH, LATENCY HELP, LATENCY HISTOGRAM, LATENCY HISTORY, LATENCY LATEST, LATENCY RESET, LOLWUT, MEMORY, MEMORY DOCTOR, MEMORY HELP, MEMORY MALLOC-STATS, MEMORY PURGE, MEMORY STATS, MEMORY USAGE, MODULE, MODULE HELP, MODULE LIST, MODULE LOAD, MODULE LOADEX, MODULE UNLOAD, MONITOR, PSYNC, REPLCONF, REPLICAOF, RESTORE-ASKING, ROLE, SAVE, SHUTDOWN, SWAPDB, SYNC, TIME.