aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorandrew-rykov <arykov@ydb.tech>2023-02-09 18:56:30 +0300
committerandrew-rykov <arykov@ydb.tech>2023-02-09 18:56:30 +0300
commit35cd948851fe388794d14b82f751006a3c271abc (patch)
tree07d2b002a704ed98b29fb4165770fef9524d28c3
parent1313b9f7953e30ef6b9ad89345605d540058ec78 (diff)
downloadydb-35cd948851fe388794d14b82f751006a3c271abc.tar.gz
pass ip from grpc
-rw-r--r--ydb/core/grpc_services/rpc_common.h4
-rw-r--r--ydb/core/grpc_services/rpc_scheme_base.h1
-rw-r--r--ydb/core/protos/flat_tx_scheme.proto1
-rw-r--r--ydb/core/protos/tx_proxy.proto1
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__operation.cpp3
-rw-r--r--ydb/core/tx/tx_proxy/schemereq.cpp1
6 files changed, 11 insertions, 0 deletions
diff --git a/ydb/core/grpc_services/rpc_common.h b/ydb/core/grpc_services/rpc_common.h
index dbcd5f9e1b3..697cf123242 100644
--- a/ydb/core/grpc_services/rpc_common.h
+++ b/ydb/core/grpc_services/rpc_common.h
@@ -46,5 +46,9 @@ inline void SetRequestType(TEvTxUserProxy::TEvProposeTransaction* ev, const IReq
ev->Record.SetRequestType(ctx.GetRequestType().GetOrElse(""));
}
+inline void SetPeerName(TEvTxUserProxy::TEvProposeTransaction* ev, const IRequestCtx& ctx) {
+ ev->Record.SetPeerName(ctx.GetPeerName());
+}
+
} // namespace NGRpcService
} // namespace NKikimr
diff --git a/ydb/core/grpc_services/rpc_scheme_base.h b/ydb/core/grpc_services/rpc_scheme_base.h
index 6d18d778869..0402a96801a 100644
--- a/ydb/core/grpc_services/rpc_scheme_base.h
+++ b/ydb/core/grpc_services/rpc_scheme_base.h
@@ -33,6 +33,7 @@ protected:
std::unique_ptr<TEvTxUserProxy::TEvProposeTransaction> proposeRequest(new TEvTxUserProxy::TEvProposeTransaction());
SetAuthToken(proposeRequest, *this->Request_);
SetDatabase(proposeRequest.get(), *this->Request_);
+ SetPeerName(proposeRequest.get(), *this->Request_);
SetRequestType(proposeRequest.get(), *this->Request_);
return proposeRequest;
}
diff --git a/ydb/core/protos/flat_tx_scheme.proto b/ydb/core/protos/flat_tx_scheme.proto
index 3e22ccf2059..4848224b1b5 100644
--- a/ydb/core/protos/flat_tx_scheme.proto
+++ b/ydb/core/protos/flat_tx_scheme.proto
@@ -52,6 +52,7 @@ message TEvModifySchemeTransaction {
optional string Owner = 5;
optional bool FailOnExist = 6; // depricated, TModifyScheme.FailOnExist is recomended
optional string UserToken = 7; // serialized NACLib::TUserToken
+ optional string PeerName = 8;
}
message TFetcherCheckUserTieringPermissionsResult {
diff --git a/ydb/core/protos/tx_proxy.proto b/ydb/core/protos/tx_proxy.proto
index dedd2f9cbb5..a12e51e5fcc 100644
--- a/ydb/core/protos/tx_proxy.proto
+++ b/ydb/core/protos/tx_proxy.proto
@@ -194,6 +194,7 @@ message TEvProposeTransaction {
optional uint64 CancelAfterMs = 6;
optional string DatabaseName = 7;
optional string RequestType = 8;
+ optional string PeerName = 9;
}
message TTxProxyTimings {
diff --git a/ydb/core/tx/schemeshard/schemeshard__operation.cpp b/ydb/core/tx/schemeshard/schemeshard__operation.cpp
index 4d7fccde2b1..b439e71e70a 100644
--- a/ydb/core/tx/schemeshard/schemeshard__operation.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__operation.cpp
@@ -58,8 +58,11 @@ void AuditLogModifySchemeTransaction(const NKikimrScheme::TEvModifySchemeTransac
databasePath.RiseUntilFirstResolvedParent();
}
+ auto peerName = request.GetPeerName();
+
AUDIT_LOG(
AUDIT_PART("txId", std::to_string(request.GetTxId()))
+ AUDIT_PART("remote_address", (!peerName.empty() ? peerName : EmptyValue) )
AUDIT_PART("subject", (!userSID.empty() ? userSID : EmptyValue))
AUDIT_PART("database", (!databasePath.IsEmpty() ? databasePath.GetDomainPathString() : EmptyValue))
AUDIT_PART("operation", logEntry.Operation)
diff --git a/ydb/core/tx/tx_proxy/schemereq.cpp b/ydb/core/tx/tx_proxy/schemereq.cpp
index ff5c90d2f5a..9729908410b 100644
--- a/ydb/core/tx/tx_proxy/schemereq.cpp
+++ b/ydb/core/tx/tx_proxy/schemereq.cpp
@@ -1066,6 +1066,7 @@ struct TBaseSchemeReq: public TActorBootstrapped<TDerived> {
}
}
+ request->Record.SetPeerName(GetRequestProto().GetPeerName());
if (GetRequestEv().HasModifyScheme()) {
request->Record.AddTransaction()->MergeFrom(GetModifyScheme());
} else {