diff --git a/mens-api/src/main/java/kr/xit/core/aop/TraceLoggerAspect.java b/mens-api/src/main/java/kr/xit/core/aop/TraceLoggerAspect.java index c2a33d2..bd13fe9 100644 --- a/mens-api/src/main/java/kr/xit/core/aop/TraceLoggerAspect.java +++ b/mens-api/src/main/java/kr/xit/core/aop/TraceLoggerAspect.java @@ -325,14 +325,37 @@ log.info("@@@@@@@@@@@@@@@@@로깅 start : [\n{}\n]",MDC.getCopyOfContextMap()); } } + @SuppressWarnings("unchecked") private JSONObject getParams(HttpServletRequest request) { JSONObject jsonObject = new JSONObject(); Enumeration params = request.getParameterNames(); while (params.hasMoreElements()) { String param = params.nextElement(); String replaceParam = param.replaceAll("\\.", "-"); - jsonObject.put(replaceParam, request.getParameter(param)); + jsonObject.put(replaceParam, maskingParam(replaceParam, request.getParameter(param))); } return jsonObject; } + + private String maskingParam(final String key, final String value){ + if("juminId".equals(key)) { + if(value.length() == 14) { + return value.replaceAll("([0-9]{6})-([1-4]{1})([0-9]{6})", "$1-$2******"); + } + return value.replaceAll("([0-9]{6})([1-4]{1})([0-9]{6})", "$1$2******"); + } + if("telNo".equals(key)) { + if(value.contains("-")){ + return value.replaceAll("-[0-9]{3,4}-", "-****-"); + }; + return value.replaceAll("([0-9]{3})([0-9]{4})([0-9]{4})", "$1$2****"); + } + if("email".equals(key)) { + return value.replaceAll("[a-z,A-Z,0-9]+@", "******@"); + } + if("name".equals(key)) { + return value.replaceAll("(?<=.{1}).", "*"); + } + return value; + } } diff --git a/mens-api/src/main/resources/logback-spring.xml b/mens-api/src/main/resources/logback-spring.xml index 1a30325..e5ae60d 100644 --- a/mens-api/src/main/resources/logback-spring.xml +++ b/mens-api/src/main/resources/logback-spring.xml @@ -33,8 +33,6 @@ - - @@ -54,13 +52,7 @@ ${FILE_LOG_PATTERN} ${FILE_LOG_CHARSET} - + ${LOG_PATH}/backup/${LOG_FILE}_%d{yyyy-MM-dd}.%i.log.gz @@ -68,14 +60,6 @@ 50 - @@ -98,15 +82,22 @@ - - - + + + + + + \"juminId\"\s*:\s*\"(.*?)\" + \"recveJuminno\"\s*:\s*\"(.*?)\" + \"recevAddr\"\s*:\s*\"(.*?)\" + \"recevDetailAddr\"\s*:\s*\"(.*?)\" + %-5p [%d{ISO8601,UTC}] [%thread] %c: %m%n%rootException + + - --> + diff --git a/mens-batch/src/main/resources/logback-spring.xml b/mens-batch/src/main/resources/logback-spring.xml index 1a30325..1d2806f 100644 --- a/mens-batch/src/main/resources/logback-spring.xml +++ b/mens-batch/src/main/resources/logback-spring.xml @@ -33,8 +33,6 @@ - - @@ -54,13 +52,7 @@ ${FILE_LOG_PATTERN} ${FILE_LOG_CHARSET} - + ${LOG_PATH}/backup/${LOG_FILE}_%d{yyyy-MM-dd}.%i.log.gz @@ -68,14 +60,6 @@ 50 - @@ -98,15 +82,21 @@ - - - + + + + + + \"recveJuminno\"\s*:\s*\"(.*?)\" + \"recevAddr\"\s*:\s*\"(.*?)\" + \"recevDetailAddr\"\s*:\s*\"(.*?)\" + %-5p [%d{ISO8601,UTC}] [%thread] %c: %m%n%rootException + + - --> + diff --git a/mens-core/src/main/java/kr/xit/core/support/logback/LogbackMaskingPatternLayout.java b/mens-core/src/main/java/kr/xit/core/support/logback/LogbackMaskingPatternLayout.java index 5583372..f134c39 100644 --- a/mens-core/src/main/java/kr/xit/core/support/logback/LogbackMaskingPatternLayout.java +++ b/mens-core/src/main/java/kr/xit/core/support/logback/LogbackMaskingPatternLayout.java @@ -1,16 +1,16 @@ package kr.xit.core.support.logback; +import ch.qos.logback.classic.PatternLayout; +import ch.qos.logback.classic.spi.ILoggingEvent; import java.util.ArrayList; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; -import java.util.stream.Collectors; import java.util.stream.IntStream; - /** - * logback log masking *
+ * description : logback log masking
  * 
  *     
  *         
@@ -22,14 +22,6 @@ import java.util.stream.IntStream;
  *         
  *     
  * 
- * 
- */ -/** - *
- * description : logback log에서
- *               1) SQL 기본로그중  "==>  Preparing: " 제외
- *               2) 파라메터 출력 로그 "==> Parameters: " 제외
- *               3) Hibernate SQL 로그 제외 : org.hibernate.SQL org.hibernate.type.descriptor.sql
  * packageName : kr.xit.core.support.logback
  * fileName    : ExcloudLogFilter
  * author      : julim
@@ -42,7 +34,6 @@ import java.util.stream.IntStream;
  * 
* @see ch.qos.logback.core.filter.Filter */ -/* public class LogbackMaskingPatternLayout extends PatternLayout { private Pattern multilinePattern; @@ -50,7 +41,7 @@ public class LogbackMaskingPatternLayout extends PatternLayout { public void addMaskPattern(String maskPattern) { maskPatterns.add(maskPattern); - multilinePattern = Pattern.compile(maskPatterns.stream().collect(Collectors.joining("|")), Pattern.MULTILINE); + multilinePattern = Pattern.compile(String.join("|", maskPatterns), Pattern.MULTILINE); } @Override @@ -74,4 +65,3 @@ public class LogbackMaskingPatternLayout extends PatternLayout { return sb.toString(); } } -*/