Skip to content

Commit bedeb0a

Browse files
Documentation for Additional Client Filters (#262)
Documentation for additional filters introduced in valkey-io/valkey#1466 Signed-off-by: Sarthak Aggarwal <[email protected]>
1 parent b8e6bcb commit bedeb0a

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

commands/client-kill.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@ instead of killing just by address. The following filters are available:
1818
* `CLIENT KILL USER username`. Closes all the connections that are authenticated with the specified [ACL](../topics/acl.md) username, however it returns an error if the username does not map to an existing ACL user.
1919
* `CLIENT KILL SKIPME yes/no`. By default this option is set to `yes`, that is, the client calling the command will not get killed, however setting this option to `no` will have the effect of also killing the client calling the command.
2020
* `CLIENT KILL MAXAGE maxage`. Closes all the connections that are older than the specified age, in seconds.
21+
* `CLIENT KILL FLAGS flags`. Kill only clients whose flag string includes the specified characters. Returns an error if valid flags are not used.
22+
* `CLIENT KILL NAME name`. Kill clients with the specified name.
23+
* `CLIENT KILL IDLE idle`. Kill only clients that have been idle for at least the specified time.
24+
* `CLIENT KILL LIB-NAME lib-name`. Kill clients using the specified library name.
25+
* `CLIENT KILL LIB-VER lib-version`. Kill clients running the specified library version.
26+
* `CLIENT KILL DB db`. Kill clients operating on the specified database id.
27+
* `CLIENT KILL IP ip`. Kill clients with the specified originating IP address.
28+
* `CLIENT KILL CAPA capa`. Kill clients that have the specified capabilities.
2129

2230
It is possible to provide multiple filters at the same time. The command will handle multiple filters via logical AND. For example:
2331

commands/client-list.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,22 @@ You can use one or more optional arguments to filter the list:
2121
- **`MAXAGE milliseconds`**: Filters the list to include only clients whose connection age (time since the client was created) is greater than or equal to the specified number of milliseconds.
2222
> Note: This is actually a minimum age, not a maximum age. This filter was first added to CLIENT KILL, where the intention was to keep clients of a maximum age and kill the ones newer than the max age.
2323
24+
- **`FLAGS flags`**: Filters the list by the client's flag string.
25+
26+
- **`NAME name`**: Filters the list to include only clients with the specified name.
27+
28+
- **`IDLE idle`**: Includes only clients that have been idle for at least the specified time.
29+
30+
- **`LIB-NAME lib-name`**: Filters the list to include only clients using the specified library name.
31+
32+
- **`LIB-VER lib-ver`**: Filters the list to include only clients with the specified library version.
33+
34+
- **`DB db`**: Filters the list to include only clients with the specified database ID.
35+
36+
- **`IP ip`**: Filters the list to include only clients with the specified IP address.
37+
38+
- **`CAPA capa`**: Filters the list to include only clients with the specified capabilities.
39+
2440
Filters can be combined to perform more precise searches. The command will handle multiple filters via logical AND.
2541

2642
Here is the meaning of the fields:
@@ -101,6 +117,8 @@ w: the client socket is writable (event loop)
101117

102118
```bash
103119
CLIENT LIST TYPE normal USER admin MAXAGE 5000 ID 1234 5678
120+
id=1234 addr=127.0.0.1:64000 laddr=127.0.0.1:6379 fd=5 name= age=600 idle=300 flags= db=0 sub=0 psub=0 ssub=0 multi=-1 watch=0 qbuf=0 qbuf-free=32768 obl=0 oll=0 omem=0 tot-mem=1024 events=r cmd=client|list user=default redir=-1 resp=2 lib-name= lib-ver=
121+
id=5678 addr=127.0.0.1:64001 laddr=127.0.0.1:6379 fd=6 name= age=900 idle=450 flags= db=0 sub=0 psub=0 ssub=0 multi=-1 watch=0 qbuf=0 qbuf-free=32768 obl=0 oll=0 omem=0 tot-mem=2048 events=r cmd=client|list user=default redir=-1 resp=2 lib-name= lib-ver=
104122
```
105123

106124
## Notes

0 commit comments

Comments
 (0)