diff options
author | ijon <[email protected]> | 2023-10-26 13:27:26 +0300 |
---|---|---|
committer | ijon <[email protected]> | 2023-10-26 14:34:42 +0300 |
commit | f5c87528cd3c738c1f4fcf4e1273e718f887eead (patch) | |
tree | 591edb639b619acc558e9be515836205efca277b | |
parent | 266692863530ed44ac18db06adf3f58d68972c69 (diff) |
auditlog: clean remote_address from prefix and port
"ipv6:[" ip-addr "]:12345" -> ip-addr
KIKIMR-18688
KIKIMR-17399
-rw-r--r-- | ydb/core/grpc_services/audit_dml_operations.cpp | 4 | ||||
-rw-r--r-- | ydb/core/grpc_services/audit_log.cpp | 3 | ||||
-rw-r--r-- | ydb/core/tx/schemeshard/schemeshard_audit_log.cpp | 3 |
3 files changed, 7 insertions, 3 deletions
diff --git a/ydb/core/grpc_services/audit_dml_operations.cpp b/ydb/core/grpc_services/audit_dml_operations.cpp index 76fe9b97de3..9bd3ac8df41 100644 --- a/ydb/core/grpc_services/audit_dml_operations.cpp +++ b/ydb/core/grpc_services/audit_dml_operations.cpp @@ -1,3 +1,5 @@ +#include <ydb/core/util/address_classifier.h> + #include <ydb/public/api/protos/ydb_table.pb.h> #include <ydb/public/api/protos/ydb_scripting.pb.h> #include <ydb/public/api/protos/ydb_query.pb.h> @@ -41,7 +43,7 @@ namespace { namespace NKikimr::NGRpcService { void AuditContextStart(IRequestCtxBase* ctx, const TString& database, const TString& userSID) { - ctx->AddAuditLogPart("remote_address", ctx->GetPeerName()); + ctx->AddAuditLogPart("remote_address", NKikimr::NAddressClassifier::ExtractAddress(ctx->GetPeerName())); ctx->AddAuditLogPart("subject", userSID); ctx->AddAuditLogPart("database", database); ctx->AddAuditLogPart("operation", ctx->GetRequestName()); diff --git a/ydb/core/grpc_services/audit_log.cpp b/ydb/core/grpc_services/audit_log.cpp index 9b652666ede..6ada27ce98e 100644 --- a/ydb/core/grpc_services/audit_log.cpp +++ b/ydb/core/grpc_services/audit_log.cpp @@ -1,5 +1,6 @@ #include "defs.h" +#include <ydb/core/util/address_classifier.h> #include <ydb/core/audit/audit_log.h> #include "base/base.h" @@ -15,7 +16,7 @@ void AuditLogConn(const IRequestProxyCtx* ctx, const TString& database, const TS AUDIT_LOG( AUDIT_PART("component", GrpcConnComponentName) - AUDIT_PART("remote_address", ctx->GetPeerName()) + AUDIT_PART("remote_address", NKikimr::NAddressClassifier::ExtractAddress(ctx->GetPeerName())) AUDIT_PART("subject", userSID) AUDIT_PART("database", database) AUDIT_PART("operation", ctx->GetRequestName()) diff --git a/ydb/core/tx/schemeshard/schemeshard_audit_log.cpp b/ydb/core/tx/schemeshard/schemeshard_audit_log.cpp index 72dc3f9e744..8bfe30debba 100644 --- a/ydb/core/tx/schemeshard/schemeshard_audit_log.cpp +++ b/ydb/core/tx/schemeshard/schemeshard_audit_log.cpp @@ -4,6 +4,7 @@ #include <ydb/core/audit/audit_log.h> #include <ydb/core/protos/flat_tx_scheme.pb.h> +#include <ydb/core/util/address_classifier.h> #include <util/string/vector.h> namespace NKikimr::NSchemeShard { @@ -73,7 +74,7 @@ void AuditLogModifySchemeTransaction(const NKikimrScheme::TEvModifySchemeTransac TPath databasePath = DatabasePathFromWorkingDir(SS, operation.GetWorkingDir()); auto [cloud_id, folder_id, database_id] = GetDatabaseCloudIds(databasePath); - auto peerName = request.GetPeerName(); + auto peerName = NKikimr::NAddressClassifier::ExtractAddress(request.GetPeerName()); AUDIT_LOG( AUDIT_PART("component", SchemeshardComponentName) |