Hello Alexey Serbin, Yingchun Lai, Kudu Jenkins, I'd like you to reexamine a change. Please visit
http://gerrit.cloudera.org:8080/21613 to look at the new patch set (#9). Change subject: [log] Support logging audit logs to a separate file ...................................................................... [log] Support logging audit logs to a separate file Currently, audit logs and regular logs are recorded together, but if we need to track audit activities, there's a high likelihood that audit logs might be lost due to interference from other logs. This patch prevents the audit logs from being insufficient for issue diagnosis due to the regular logs rolling over too quickly. By researching how to use glog [1], I found that we can achieve our goal by overriding the send function. In this patch, I implemented this feature to redirect audit logs. Currently considering recording the RPC requests for table creation, deletion, alteration, and recall operations to the audit log. Usage: If we have the following two log outputs in the code: ```cpp // Normal logging. LOG(INFO) << "Normal logging."; // Audit logging to custom sink. LOG_AUDIT(INFO) << "Audit logging to custom sink."; ``` If --master_audit_log_record_independently is set to `false`, we will get one log file containing two log entries: ``` I20240801 12:42:39.344545 15083 audit_logger-test.cc:90] Normal logging. I20240801 12:42:39.344591 15083 audit_logger-test.cc:93] Audit logging to custom sink. ``` If --master_audit_log_record_independently is set to `true`, we will get two log files. One file will contain the same two log entries as before: ``` I20240801 12:42:39.344545 15083 audit_logger-test.cc:90] Normal logging. I20240801 12:42:39.344591 15083 audit_logger-test.cc:93] Audit logging to custom sink. ``` The other log file will contain only one log entry: ``` I20240801 12:42:39.344591 15083 audit_logger-test.cc:93] Audit logging to custom sink. ``` And the filename is approximately similar to kudu_master.7732168b9e26.root.AuditLog.20240808-170313.0.25681. This feature is similar to how we can see fatal-level logs in info-level logging, while in fatal-level logs, only fatal-level entries appear. This patch allows us to see audit-related logs in info-level logging, while also generating a separate audit file specifically for storing audit-related log records. Considering the current limited scope of use, audit logs of different levels will all be recorded in the same log file. In the future, we can consider storing audit logs separately by level. To verify this functionality, I also wrote unit tests to validate the newly added logic. 1. https://google.github.io/glog/stable/sinks/ Change-Id: Ie5323361befb456d91a12da7273865542f1d2430 --- M src/kudu/master/CMakeLists.txt A src/kudu/master/audit_logger-test.cc A src/kudu/master/audit_logger.cc A src/kudu/master/audit_logger.h M src/kudu/master/catalog_manager.cc M src/kudu/master/master-test.cc 6 files changed, 515 insertions(+), 10 deletions(-) git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/13/21613/9 -- To view, visit http://gerrit.cloudera.org:8080/21613 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-Project: kudu Gerrit-Branch: master Gerrit-MessageType: newpatchset Gerrit-Change-Id: Ie5323361befb456d91a12da7273865542f1d2430 Gerrit-Change-Number: 21613 Gerrit-PatchSet: 9 Gerrit-Owner: KeDeng <kdeng...@gmail.com> Gerrit-Reviewer: Alexey Serbin <ale...@apache.org> Gerrit-Reviewer: KeDeng <kdeng...@gmail.com> Gerrit-Reviewer: Kudu Jenkins (120) Gerrit-Reviewer: Yingchun Lai <laiyingc...@apache.org>