diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2018-03-27 20:43:34 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2018-03-27 20:53:06 +0200 |
commit | b648974cc35a65df87c2801f5c09dd13d3e507f7 (patch) | |
tree | d990e38ca08d433941c70f45d9a1bb72ca18fa06 /src/rpc | |
parent | e49ba2e23b78b33de92fe90d48c60252f2135616 (diff) | |
parent | 4d74c78c69123a3d97293f40337e2efa5dadbff0 (diff) |
Merge #12778: RPC: Add username and ip logging for RPC method requests
4d74c78 Add username and ip logging for RPC method requests (Gabriel Davidian)
Pull request description:
Adds username and IP logging (if enabled via -logips command) to RPC method request logging.
This closes #12223
Tree-SHA512: a441228e80ea6884ec379c66e949d86df3689770f1b3c3608015cf5a36d2dfb38051298a7f6ea6dfdfbf0b3b6c896e414c8dc54e9833bb73dd65bdb1832f4395
Diffstat (limited to 'src/rpc')
-rw-r--r-- | src/rpc/server.cpp | 6 | ||||
-rw-r--r-- | src/rpc/server.h | 1 |
2 files changed, 6 insertions, 1 deletions
diff --git a/src/rpc/server.cpp b/src/rpc/server.cpp index 54995ef000..c7c3b1f0d3 100644 --- a/src/rpc/server.cpp +++ b/src/rpc/server.cpp @@ -367,7 +367,11 @@ void JSONRPCRequest::parse(const UniValue& valRequest) if (!valMethod.isStr()) throw JSONRPCError(RPC_INVALID_REQUEST, "Method must be a string"); strMethod = valMethod.get_str(); - LogPrint(BCLog::RPC, "ThreadRPCServer method=%s\n", SanitizeString(strMethod)); + if (fLogIPs) + LogPrint(BCLog::RPC, "ThreadRPCServer method=%s user=%s peeraddr=%s\n", SanitizeString(strMethod), + this->authUser, this->peerAddr); + else + LogPrint(BCLog::RPC, "ThreadRPCServer method=%s user=%s\n", SanitizeString(strMethod), this->authUser); // Parse params UniValue valParams = find_value(request, "params"); diff --git a/src/rpc/server.h b/src/rpc/server.h index d25268a8ab..7fc300f554 100644 --- a/src/rpc/server.h +++ b/src/rpc/server.h @@ -45,6 +45,7 @@ public: bool fHelp; std::string URI; std::string authUser; + std::string peerAddr; JSONRPCRequest() : id(NullUniValue), params(NullUniValue), fHelp(false) {} void parse(const UniValue& valRequest); |