-
Notifications
You must be signed in to change notification settings - Fork 606
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
24-3: Add basic dynconfig audit (#8155)
- Loading branch information
Showing
8 changed files
with
179 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#include "console_audit.h" | ||
|
||
#include <ydb/core/audit/audit_log.h> | ||
#include <ydb/core/util/address_classifier.h> | ||
|
||
namespace NKikimr::NConsole { | ||
|
||
void AuditLogReplaceConfigTransaction( | ||
const TString& peer, | ||
const TString& userSID, | ||
const TString& oldConfig, | ||
const TString& newConfig, | ||
const TString& reason, | ||
bool success) | ||
{ | ||
static const TString COMPONENT_NAME = "console"; | ||
|
||
static const TString EMPTY_VALUE = "{none}"; | ||
|
||
auto peerName = NKikimr::NAddressClassifier::ExtractAddress(peer); | ||
|
||
AUDIT_LOG( | ||
AUDIT_PART("component", COMPONENT_NAME) | ||
AUDIT_PART("remote_address", (!peerName.empty() ? peerName : EMPTY_VALUE)) | ||
AUDIT_PART("subject", (!userSID.empty() ? userSID : EMPTY_VALUE)) | ||
AUDIT_PART("status", TString(success ? "SUCCESS" : "ERROR")) | ||
AUDIT_PART("reason", reason, !reason.empty()) | ||
AUDIT_PART("operation", TString("REPLACE DYNCONFIG")) | ||
AUDIT_PART("old_config", oldConfig) | ||
AUDIT_PART("new_config", newConfig) | ||
); | ||
} | ||
|
||
} // namespace NKikimr::NConsole |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#pragma once | ||
|
||
#include <util/generic/string.h> | ||
|
||
namespace NKikimr::NConsole { | ||
|
||
void AuditLogReplaceConfigTransaction( | ||
const TString& peer, | ||
const TString& userSID, | ||
const TString& oldConfig, | ||
const TString& newConfig, | ||
const TString& reason, | ||
bool success); | ||
|
||
} // namespace NKikimr::NConsole |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters