StackExchange/StackExchange.Redis

Client name not visible in logs?

dominikjeske opened this issue · 5 comments

I have following configuration

Client version: 2.8.0
Server version (KeyDB): 6.2.2

var connectionOptions = new ConfigurationOptions
{
    ClientName = "TEST",
    CommandMap = "SETNAME", "GETNAME"... and others
};

I'm trying to set client name by simply set ClientName in configuration but on server it looks like below

id=54637111 addr=66.66.66.66:62494 laddr=666.666.666.666:666 fd=49 name= age=163 idle=13 flags=N db=11 sub=0 psub=0 multi=-1 qbuf=0 qbuf-free=0 argv-mem=0 obl=0 oll=0 omem=0 tot-mem=20504 events=r cmd=get user=default redir=-1

I set SETNAME in Command map and still it is not set.

Is there anything else needed or maybe it is a bug?

We can't really speak to KeyDB's handling of the SETNAME command here - this could be a server-side issue to take up on that end. One thing we can see is your CommandMap has SETNAME and GETNAME but the core command here is CLIENT - is that allowed in your list?

Thanks for suggestion. I don't have CLIENT command in my map so I will check it out. I just wanted to assure I'm doing everything right from client side and I will investigate server side next.

I found source of the problem - admins of KeyDB have blocked CLIENT command. After allowing this command I can see client name in logs. Another thing is that SETNAME/GETNAME command is not enough for enabling this feature - for me it is not intuitive.

That's because there is no SETNAME / GETNAME command; the command is CLIENT - everything else is data for that command (I guess you could also categorize it as subcommands, but the command configuration in Redis doesn't care about subcommands as a concept)

Side note : if the server supports RESP3, that might also be an option - since the HELLO command also allows SETNAME; so: it may be worth trying RESP3

Since this is KeyDB rather than pure Redis, I can make no comment as to how likely this is to work.