Ali Alsuliman has uploaded a new change for review. https://asterix-gerrit.ics.uci.edu/3105
Change subject: [NO ISSUE][OTH] Support log redaction ...................................................................... [NO ISSUE][OTH] Support log redaction - user model changes: no - storage format changes: no - interface changes: no Details: Support log redaction. Change-Id: I602c833ba2a055da8fbe8782ec62be683ff4581b --- M hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/CCDriver.java M hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/controllers/ControllerConfig.java M hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/NCDriver.java A hyracks-fullstack/hyracks/hyracks-util/src/main/java/org/apache/hyracks/util/LogRedaction.java 4 files changed, 57 insertions(+), 1 deletion(-) git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb refs/changes/05/3105/1 diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/CCDriver.java b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/CCDriver.java index 8b58046..5d042bd 100644 --- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/CCDriver.java +++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/CCDriver.java @@ -27,6 +27,7 @@ import org.apache.hyracks.control.common.config.ConfigManager; import org.apache.hyracks.control.common.config.ConfigUtils; import org.apache.hyracks.control.common.controllers.CCConfig; +import org.apache.hyracks.util.LogRedaction; import org.apache.logging.log4j.Level; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -56,6 +57,7 @@ configManager.processConfig(); ctx.start(logCfgFactory.getConfiguration(ctx, ConfigurationSource.NULL_SOURCE)); ClusterControllerService ccService = new ClusterControllerService(ccConfig, application); + LogRedaction.init(ccService.getConfig().getUDStartTag(), ccService.getConfig().getUDEndTag()); ccService.start(); while (true) { Thread.sleep(100000); diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/controllers/ControllerConfig.java b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/controllers/ControllerConfig.java index dc229e0..cefc296 100644 --- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/controllers/ControllerConfig.java +++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/controllers/ControllerConfig.java @@ -19,6 +19,7 @@ package org.apache.hyracks.control.common.controllers; import static org.apache.hyracks.control.common.config.OptionTypes.BOOLEAN; +import static org.apache.hyracks.control.common.config.OptionTypes.STRING; import java.io.Serializable; import java.net.URL; @@ -49,7 +50,9 @@ (Function<IApplicationConfig, String>) appConfig -> FileUtil .joinPath(appConfig.getString(ControllerConfig.Option.DEFAULT_DIR), "logs"), "The directory where logs for this node are written"), - SSL_ENABLED(BOOLEAN, false, "A flag indicating if cluster communications should use secured connections"); + SSL_ENABLED(BOOLEAN, false, "A flag indicating if cluster communications should use secured connections"), + LOG_UD_START_TAG(STRING, "", "The start tag marking the beginning of the user data to be redacted"), + LOG_UD_END_TAG(STRING, "", "The end tag marking the end of the user data to be redacted"); private final IOptionType type; private final String description; @@ -129,4 +132,12 @@ public boolean isSslEnabled() { return getAppConfig().getBoolean(Option.SSL_ENABLED); } + + public String getUDStartTag() { + return getAppConfig().getString(Option.LOG_UD_START_TAG); + } + + public String getUDEndTag() { + return getAppConfig().getString(Option.LOG_UD_END_TAG); + } } diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/NCDriver.java b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/NCDriver.java index b460735..bad6a3d 100644 --- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/NCDriver.java +++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/NCDriver.java @@ -25,6 +25,7 @@ import org.apache.hyracks.control.common.config.ConfigManager; import org.apache.hyracks.control.common.config.ConfigUtils; import org.apache.hyracks.control.common.controllers.NCConfig; +import org.apache.hyracks.util.LogRedaction; import org.apache.logging.log4j.Level; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -56,6 +57,7 @@ cfg.removeLogger("Console"); ctx.start(logCfgFactory.getConfiguration(ctx, ConfigurationSource.NULL_SOURCE)); final NodeControllerService ncService = new NodeControllerService(ncConfig, application); + LogRedaction.init(ncService.getConfiguration().getUDStartTag(), ncService.getConfiguration().getUDEndTag()); ncService.start(); while (true) { Thread.sleep(10000); diff --git a/hyracks-fullstack/hyracks/hyracks-util/src/main/java/org/apache/hyracks/util/LogRedaction.java b/hyracks-fullstack/hyracks/hyracks-util/src/main/java/org/apache/hyracks/util/LogRedaction.java new file mode 100644 index 0000000..746b28b --- /dev/null +++ b/hyracks-fullstack/hyracks/hyracks-util/src/main/java/org/apache/hyracks/util/LogRedaction.java @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.hyracks.util; + +public class LogRedaction { + + private static String START_UD = ""; + private static String END_UD = ""; + + private LogRedaction() { + } + + public static void init(String startUD, String endUD) { + START_UD = startUD; + END_UD = endUD; + } + + public static String redact(String text) { + if (START_UD.isEmpty() && END_UD.isEmpty()) { + return text; + } + return START_UD + text + END_UD; + } +} -- To view, visit https://asterix-gerrit.ics.uci.edu/3105 To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I602c833ba2a055da8fbe8782ec62be683ff4581b Gerrit-PatchSet: 1 Gerrit-Project: asterixdb Gerrit-Branch: master Gerrit-Owner: Ali Alsuliman <ali.al.solai...@gmail.com>