COMMANDLOG-GET(3valkey)

πŸ“¦
version 9.0.6 Β· 2 versions
, in fedora 44

πŸ’– COMMANDLOG-GET πŸ’–

okay bestie, so this page is from the Valkey Command Manual, and we're talking about commandlog-get β€” it literally just returns the entries from the command log you asked for. no cap. πŸŽ€


✨ NAME ✨

commandlog-get β€” returns the specified command log's entries. periodt. πŸ’…


🌈 SYNOPSIS 🌈

COMMANDLOG GET count <SLOW | LARGE-REQUEST | LARGE-REPLY>

πŸ¦‹ DESCRIPTION πŸ¦‹

So the COMMANDLOG GET command hands you back entries from the command log of the type you picked, in chronological order. oldest first, like a story. πŸ’œ

The Command Log system is out here recording commands that eat up significant resources while the server is doing its thing β€” that's CPU, memory, and network bandwidth. these commands and the data they touch can lowkey push an instance into weird behaviour, and the command log is there so you can quickly and intuitively locate the issue. it's giving detective. πŸ”

Right now, three types of command logs are supported:

  • SLOW: logs commands that exceed a specified execution time. this one 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. so it's the pure command brain work. 🧠
  • LARGE-REQUEST: logs commands with requests exceeding a defined size. this helps you spot potentially problematic commands that send excessive data to the server. πŸ™ˆ
  • LARGE-REPLY: logs commands that generate replies exceeding a defined size. this helps you spot commands returning 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 valkey-commandlog-reset(7) 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:

  1. A unique progressive identifier for every entry.
  2. The unix timestamp at which the logged command was processed.
  3. Each type of command log has its own meaning, currently there are three types:
    • time in microseconds for type of slow
    • size in bytes for type of large-request
    • size in bytes for type of large-reply
  4. The array composing the arguments of the command.
  5. Client peer information (e.g. Client IP address and port for TCP connected clients or unix path for unix sockets).
  6. Client name if set via the valkey-client-setname(7) 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 valkey-commandlog-reset(7) COMMANDLOG RESET was executed. in order to reset the ID a server restart is needed. so yeah, that ID is committed for life. πŸ‘‘


⭐ COMPLEXITY ⭐

O(N) where N is the number of entries returned


πŸ”₯ ACL CATEGORIES πŸ”₯

@admin @dangerous @slow

ngl, @dangerous is right there in the list, so maybe don't yolo it in prod without thinking. πŸ™ˆ

🌸 HISTORY 🌸

  • Available since: 8.1.0

πŸ’– SEE ALSO πŸ’–

acl(3valkey), acl-cat(3valkey), acl-deluser(3valkey), acl-dryrun(3valkey), acl-genpass(3valkey), acl-getuser(3valkey), acl-help(3valkey), acl-list(3valkey), acl-load(3valkey), acl-log(3valkey), acl-save(3valkey), acl-setuser(3valkey), acl-users(3valkey), acl-whoami(3valkey), bgrewriteaof(3valkey), bgsave(3valkey), command(3valkey), command-count(3valkey), command-docs(3valkey), command-getkeys(3valkey), command-getkeysandflags(3valkey), command-help(3valkey), command-info(3valkey), command-list(3valkey), commandlog(3valkey), commandlog-help(3valkey), commandlog-len(3valkey), commandlog-reset(3valkey), config(3valkey), config-get(3valkey), config-help(3valkey), config-resetstat(3valkey), config-rewrite(3valkey), config-set(3valkey), dbsize(3valkey), debug(3valkey), failover(3valkey), flushall(3valkey), flushdb(3valkey), info(3valkey), lastsave(3valkey), latency(3valkey), latency-doctor(3valkey), latency-graph(3valkey), latency-help(3valkey), latency-histogram(3valkey), latency-history(3valkey), latency-latest(3valkey), latency-reset(3valkey), lolwut(3valkey), memory(3valkey), memory-doctor(3valkey), memory-help(3valkey), memory-malloc-stats(3valkey), memory-purge(3valkey), memory-stats(3valkey), memory-usage(3valkey), module(3valkey), module-help(3valkey), module-list(3valkey), module-load(3valkey), module-loadex(3valkey), module-unload(3valkey), monitor(3valkey), psync(3valkey), replconf(3valkey), replicaof(3valkey), restore-asking(3valkey), role(3valkey), save(3valkey), shutdown(3valkey), slowlog(3valkey), slowlog-get(3valkey), slowlog-help(3valkey), slowlog-len(3valkey), slowlog-reset(3valkey), swapdb(3valkey), sync(3valkey), time(3valkey)


okay that's the whole page, you ate it bestie 🫢 this one's from Valkey version 9.0.0, dated 2025-10-21, and it lives in the Valkey Command Manual. go forth and log responsibly πŸ’…βœ¨

πŸ“¦ where this page comes from