summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2015-08-21 15:29:07 +0200
committerantirez <antirez@gmail.com>2015-08-21 15:30:49 +0200
commit49f2f691cbf62aa77ebeed1edd8b008cac622e5c (patch)
treeef02182460fb66eee7e22be2d50e8b17e3ebb43c
parentc2ff9de31bf061183865c230918527c105924fa1 (diff)
downloadredis-49f2f691cbf62aa77ebeed1edd8b008cac622e5c.tar.gz
Log client details on SLAVEOF command having an effect.
-rw-r--r--src/replication.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/replication.c b/src/replication.c
index 02072e413..cef65dfd7 100644
--- a/src/replication.c
+++ b/src/replication.c
@@ -1716,7 +1716,10 @@ void slaveofCommand(redisClient *c) {
!strcasecmp(c->argv[2]->ptr,"one")) {
if (server.masterhost) {
replicationUnsetMaster();
- redisLog(REDIS_NOTICE,"MASTER MODE enabled (user request)");
+ sds client = catClientInfoString(sdsempty(),c);
+ redisLog(REDIS_NOTICE,
+ "MASTER MODE enabled (user request from '%s')",client);
+ sdsfree(client);
}
} else {
long port;
@@ -1734,8 +1737,10 @@ void slaveofCommand(redisClient *c) {
/* There was no previous master or the user specified a different one,
* we can continue. */
replicationSetMaster(c->argv[1]->ptr, port);
- redisLog(REDIS_NOTICE,"SLAVE OF %s:%d enabled (user request)",
- server.masterhost, server.masterport);
+ sds client = catClientInfoString(sdsempty(),c);
+ redisLog(REDIS_NOTICE,"SLAVE OF %s:%d enabled (user request from '%s')",
+ server.masterhost, server.masterport, client);
+ sdsfree(client);
}
addReply(c,shared.ok);
}