Skip to content

HDFS-16944 Add audit log for RouterAdminServer to save privileged operation log seperately. #5464

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ public class RouterAdminServer extends AbstractService

private static final Logger LOG =
LoggerFactory.getLogger(RouterAdminServer.class);
private static final Logger AUDITLOG =
LoggerFactory.getLogger(RouterAdminServer.class.getName() + ".audit");

private Configuration conf;

Expand Down Expand Up @@ -514,11 +516,11 @@ public EnterSafeModeResponse enterSafeMode(EnterSafeModeRequest request)
safeModeService.setManualSafeMode(true);
success = verifySafeMode(true);
if (success) {
LOG.info("STATE* Safe mode is ON.\n" + "It was turned on manually. "
AUDITLOG.info("STATE* Safe mode is ON.\n" + "It was turned on manually. "
+ "Use \"hdfs dfsrouteradmin -safemode leave\" to turn"
+ " safe mode off.");
} else {
LOG.error("Unable to enter safemode.");
AUDITLOG.error("Unable to enter safemode.");
}
}
return EnterSafeModeResponse.newInstance(success);
Expand All @@ -535,9 +537,9 @@ public LeaveSafeModeResponse leaveSafeMode(LeaveSafeModeRequest request)
safeModeService.setManualSafeMode(false);
success = verifySafeMode(false);
if (success) {
LOG.info("STATE* Safe mode is OFF.\n" + "It was turned off manually.");
AUDITLOG.info("STATE* Safe mode is OFF.\n" + "It was turned off manually.");
} else {
LOG.error("Unable to leave safemode.");
AUDITLOG.error("Unable to leave safemode.");
}
}
return LeaveSafeModeResponse.newInstance(success);
Expand Down Expand Up @@ -676,12 +678,12 @@ public DisableNameserviceResponse disableNameservice(
if (namespaceExists(nsId)) {
success = getDisabledNameserviceStore().disableNameservice(nsId);
if (success) {
LOG.info("Nameservice {} disabled successfully.", nsId);
AUDITLOG.info("Nameservice {} disabled successfully.", nsId);
} else {
LOG.error("Unable to disable Nameservice {}", nsId);
AUDITLOG.error("Unable to disable Nameservice {}", nsId);
}
} else {
LOG.error("Cannot disable {}, it does not exists", nsId);
AUDITLOG.error("Cannot disable {}, it does not exists", nsId);
}
return DisableNameserviceResponse.newInstance(success);
}
Expand Down Expand Up @@ -711,12 +713,12 @@ public EnableNameserviceResponse enableNameservice(
if (disabled.contains(nsId)) {
success = store.enableNameservice(nsId);
if (success) {
LOG.info("Nameservice {} enabled successfully.", nsId);
AUDITLOG.info("Nameservice {} enabled successfully.", nsId);
} else {
LOG.error("Unable to enable Nameservice {}", nsId);
AUDITLOG.error("Unable to enable Nameservice {}", nsId);
}
} else {
LOG.error("Cannot enable {}, it was not disabled", nsId);
AUDITLOG.error("Cannot enable {}, it was not disabled", nsId);
}
return EnableNameserviceResponse.newInstance(success);
}
Expand Down