A Redis service starts failing with `NOPERM` after moving to its own ACL user; how do you use `ACL LOG` to find what was denied?
answer
- the server remembers recent refusals
- reason plus object says what failed
- username and client-info say who
- test the fix before deploying it
basics
~20 sRun ACL LOG on the server that refused the call. Each entry gives a reason (command, key, channel or auth), the object denied, the username and client info. Then widen the rule and confirm it with ACL DRYRUN.
solid answer
~40 s`ACL LOG` lists recent security events, most recent first and ten by default, so I run it on the node that refused the call. `reason` says which check failed: `command`, `key`, `channel` or `auth`. `object` names what was denied, `username` and `client-info` say who, and `context` says whether it came from a plain call, `MULTI`, a Lua script or a module. Repeats with the same reason, context, object and username inside 60 seconds fold into one entry with a `count`. I then widen only that rule, checking it with `ACL DRYRUN` before redeploying. The log lives in memory on one server and holds refusals only, so it is a troubleshooting tool, not an audit trail.
code
plaintext · 14 lines> ACL LOG 1
1) 1) "count"
2) (integer) 3
3) "reason"
4) "key"
5) "context"
6) "toplevel"
7) "object"
8) "orders:1042"
9) "username"
10) "reporting"
...
> ACL DRYRUN reporting GET orders:1042
OKgo deeper
Recall that ACL LOG exists and lists recent refusals and failed logins. Be able to name the reason field and say what command, key, channel and auth each mean.
Walk through a real diagnosis: read the reply, find the entry, compare object with the user's patterns, and prove the fix with ACL DRYRUN before changing anything.
Explain how grouping and trimming distort what you read, why a refused call may be a bug the new rules exposed, and why the INFO counters are the better signal for trends.
Decide what a team relies on for evidence of denied access, given that the log is capped, held in memory and per node, and whether its entries need collecting elsewhere.
## What the log records Redis keeps an in-memory list of recent **ACL security events**: commands refused by the caller's rules, and failed logins through `AUTH` or `HELLO`. `ACL LOG` returns them newest first, ten by default, and `ACL LOG 50` asks for more. `ACL LOG RESET` clears the list and replies `OK`. Reading the log is itself an administrative command, so a service user normally cannot read its own refusals, and you need an admin login. ## Reading an entry | Field | What it tells you | |---|---| | `reason` | The failed check: `command`, `key`, `channel` or `auth` | | `object` | What was denied, such as the command or the key name | | `username` | The user that ran the command or failed to log in | | `context` | Where it happened: `toplevel`, `multi`, `lua` or `module` | | `count` | How many events this entry stands for | | `client-info` | The connection, in `CLIENT LIST` format, including `addr` | | `entry-id` | A sequence number since the server process started | The reason narrows the fix straight away, and it pairs with the reply the client saw: - `reason` `command` pairs with `NOPERM User reporting has no permissions to run the 'set' command`, and the fix is a command rule. - `reason` `key` pairs with `NOPERM No permissions to access a key`, where the reply hides the name but the log's `object` shows it. Compare that name with the user's patterns. - `reason` `channel` pairs with `NOPERM No permissions to access a channel`, and the fix is a `&` rule. - `reason` `auth` follows `WRONGPASS invalid username-password pair or user is disabled.`, which suggests a wrong secret, a disabled user or a user that was never created on this server. The `context` field catches a case that is easy to miss. Commands inside a Lua script are checked against the caller's rules as well, so a call inside a script can be refused although the client's own `EVALSHA` was permitted. ## A diagnosis, step by step Take a reporting job, moved off a shared password, that fails on some keys: 1. Read the client's error to see which kind of `NOPERM` it received. 2. Run `ACL LOG 10` on the node the client was talking to, not on another one. 3. Find the entry whose `username` is `reporting`. Say it shows `reason` `key` and `object` `orders:1042`. 4. Compare that with `ACL GETUSER reporting` and decide whether the job should touch that key at all. A refusal can be a correct one that has exposed a bug. 5. Test the change without touching data: `ACL DRYRUN reporting GET orders:1042` returns `OK` or the reason it would be refused. 6. Apply the narrowest rule that passes, then `ACL LOG RESET` so the next read shows only new refusals. ## How entries are grouped and lost Two behaviours affect how you read the numbers: - **Grouping.** A new event joins an existing entry when reason, context, object and username all match and the two are within 60 seconds. So one entry with a high `count` can be a retry loop, and each different key name makes its own entry. - **Trimming.** `acllog-max-len` caps the list and defaults to `128`. The oldest entries go first, so a noisy client can push out the one you wanted. Gaps in `entry-id` show that entries fell out between two reads. ## What it is not `ACL LOG` is useful for troubleshooting, with limits that matter if someone treats it as an audit record: - It holds refusals only. A permitted `FLUSHALL` leaves no entry. - It is held in memory on one server, so a restart empties it and each node keeps its own. - It is capped, so it cannot serve as a long-term record. For a trend rather than an incident, `INFO stats` carries counters that outlive the trimming: `acl_access_denied_auth`, `acl_access_denied_cmd`, `acl_access_denied_key` and `acl_access_denied_channel`. A rising key count after a deploy is a good reason to go and read the log. The log also helps before an incident. During a migration, run a service against its new user in a test environment and read the log afterwards: each entry is either a rule you forgot or a call the service should not be making.
- `ACL LOG` shows nothing for a call the client says was refused. What would you check?First, that you are on the same node, since each server keeps its own log. Then check that a restart or `ACL LOG RESET` did not empty it, that `acllog-max-len` is not `0`, and that the error really was `NOPERM`, because a `NOAUTH` reply is not an ACL rule refusal.
- What does `ACL DRYRUN` add that `ACL GETUSER` does not?`ACL GETUSER` shows the rules and leaves you to work out the result. `ACL DRYRUN <user> <command> [args]` evaluates them for a specific call without running it, even if the user is disabled, and replies `OK` or a message saying what would be refused, so it suits checking a rule before deploying.
- ACL LOG records every command each user runs, so it works as an audit trail
- ACL LOG entries survive a restart because Redis saves them to disk
- Any one node's ACL LOG shows the refusals from the whole cluster
- The NOPERM reply to a client always names the key it was denied
- A count of 40 on one entry means forty different keys were refused