mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2025-05-10 18:05:44 +02:00
chore: tune logs and improve restrict denied error (#4145)
1. Now error stats show "restrict_denied" instead of "Cannot execute restricted command ..." error. 2. Increased verbosity level when loading a key with expired timestamp. 3. pulled helio with better logs coverage of tls_socket.cc code. Signed-off-by: Roman Gershman <roman@dragonflydb.io>
This commit is contained in:
parent
907346e3e6
commit
794bd1cdb3
5 changed files with 6 additions and 4 deletions
2
helio
2
helio
|
@ -1 +1 @@
|
|||
Subproject commit 438c86139eac2e6400f2aae1d46cff03b31c166f
|
||||
Subproject commit e6f69f118a1af4d677d0ef8a2da3f0b50fcc7cef
|
|
@ -42,5 +42,6 @@ extern const char kScriptErrType[];
|
|||
extern const char kConfigErrType[];
|
||||
extern const char kSearchErrType[];
|
||||
extern const char kWrongTypeErrType[];
|
||||
extern const char kRestrictDenied[];
|
||||
|
||||
} // namespace facade
|
||||
|
|
|
@ -103,6 +103,7 @@ const char kScriptErrType[] = "script_error";
|
|||
const char kConfigErrType[] = "config_error";
|
||||
const char kSearchErrType[] = "search_error";
|
||||
const char kWrongTypeErrType[] = "wrong_type";
|
||||
const char kRestrictDenied[] = "restrict_denied";
|
||||
|
||||
const char* RespExpr::TypeName(Type t) {
|
||||
switch (t) {
|
||||
|
|
|
@ -1028,9 +1028,9 @@ std::optional<ErrorReply> Service::VerifyCommandState(const CommandId* cid, CmdA
|
|||
// If there is no connection owner, it means the command it being called
|
||||
// from another command or used internally, therefore is always permitted.
|
||||
if (dfly_cntx.conn() != nullptr && !dfly_cntx.conn()->IsPrivileged() && cid->IsRestricted()) {
|
||||
VLOG(1) << "Non-admin attempt to execute " << cid->name() << " "
|
||||
VLOG(1) << "Non-admin attempt to execute " << cid->name() << " " << tail_args << " "
|
||||
<< ConnectionLogContext(dfly_cntx.conn());
|
||||
return ErrorReply{"Cannot execute restricted command (admin only)"};
|
||||
return ErrorReply{"Cannot execute restricted command (admin only)", kRestrictDenied};
|
||||
}
|
||||
|
||||
if (auto err = cid->Validate(tail_args); err)
|
||||
|
|
|
@ -2733,7 +2733,7 @@ void RdbLoader::LoadItemsBuffer(DbIndex db_ind, const ItemsBuf& ib) {
|
|||
}
|
||||
|
||||
if (item->expire_ms > 0 && db_cntx.time_now_ms >= item->expire_ms) {
|
||||
VLOG(1) << "Expire key on load: " << item->key;
|
||||
VLOG(2) << "Expire key on load: " << item->key;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue