feat: batch https 적용

profile fix
dev
gitea-관리자 1 year ago
parent b62f02d438
commit e0a6341756

@ -325,14 +325,37 @@ log.info("@@@@@@@@@@@@@@@@@로깅 start : [\n{}\n]",MDC.getCopyOfContextMap());
} }
} }
@SuppressWarnings("unchecked")
private JSONObject getParams(HttpServletRequest request) { private JSONObject getParams(HttpServletRequest request) {
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
Enumeration<String> params = request.getParameterNames(); Enumeration<String> params = request.getParameterNames();
while (params.hasMoreElements()) { while (params.hasMoreElements()) {
String param = params.nextElement(); String param = params.nextElement();
String replaceParam = param.replaceAll("\\.", "-"); String replaceParam = param.replaceAll("\\.", "-");
jsonObject.put(replaceParam, request.getParameter(param)); jsonObject.put(replaceParam, maskingParam(replaceParam, request.getParameter(param)));
} }
return jsonObject; 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;
}
} }

@ -33,8 +33,6 @@
</encoder> </encoder>
</appender> </appender>
<!-- ============================================================================= --> <!-- ============================================================================= -->
<!-- console logging Appender defined -->
<!-- ============================================================================= -->
<!-- ============================================================================= --> <!-- ============================================================================= -->
<!-- file logging Appender defined --> <!-- file logging Appender defined -->
@ -54,13 +52,7 @@
<pattern>${FILE_LOG_PATTERN}</pattern> <pattern>${FILE_LOG_PATTERN}</pattern>
<charset>${FILE_LOG_CHARSET}</charset> <charset>${FILE_LOG_CHARSET}</charset>
</encoder> </encoder>
<!--
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
<layout class="kr.xit.core.support.logback.PatternLayoutWithUserContext">
<param name="Pattern" value="%d{yyyy-MM-dd HH:mm:ss.SSS} %session %-5level %logger{10} - %user %msg%n" />
</layout>
</encoder>
-->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${LOG_PATH}/backup/${LOG_FILE}_%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern> <fileNamePattern>${LOG_PATH}/backup/${LOG_FILE}_%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
@ -68,14 +60,6 @@
</timeBasedFileNamingAndTriggeringPolicy> </timeBasedFileNamingAndTriggeringPolicy>
<maxHistory>50</maxHistory> <maxHistory>50</maxHistory>
</rollingPolicy> </rollingPolicy>
<!--
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>${LOG_PATH}}/logs/backup/${LOG_FILE}-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<maxFileSize>500MB</maxFileSize>
<maxHistory>60</maxHistory>
<totalSizeCap>10GB</totalSizeCap>
</rollingPolicy>
-->
</appender> </appender>
<!-- async appender defined --> <!-- async appender defined -->
@ -98,15 +82,22 @@
</filter> </filter>
</appender> </appender>
<!-- ============================================================================= --> <!-- ============================================================================= -->
<!-- file logging Appender defined -->
<!-- ============================================================================= -->
<!-- <!-- ============================================================================= -->
<appender name="LogstashAppender" class="net.logstash.logback.appender.LogstashTcpSocketAppender"> <!-- logging mask defined -->
<remoteHost>127.0.0.1</remoteHost> <!-- ============================================================================= -->
<port>5000</port> <appender name="mask" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
<layout class="kr.xit.core.support.logback.LogbackMaskingPatternLayout">
<maskPattern>\"juminId\"\s*:\s*\"(.*?)\"</maskPattern> <!-- SSN JSON pattern -->
<maskPattern>\"recveJuminno\"\s*:\s*\"(.*?)\"</maskPattern> <!-- SSN JSON pattern -->
<maskPattern>\"recevAddr\"\s*:\s*\"(.*?)\"</maskPattern> <!-- Address JSON pattern -->
<maskPattern>\"recevDetailAddr\"\s*:\s*\"(.*?)\"</maskPattern> <!-- Address JSON pattern -->
<pattern>%-5p [%d{ISO8601,UTC}] [%thread] %c: %m%n%rootException</pattern>
</layout>
</encoder>
</appender> </appender>
--> <!-- ============================================================================= -->
<!-- ************************************************************************* --> <!-- ************************************************************************* -->
<!-- SQL log : root appender로 로그 전파 - additivity="true" --> <!-- SQL log : root appender로 로그 전파 - additivity="true" -->

@ -33,8 +33,6 @@
</encoder> </encoder>
</appender> </appender>
<!-- ============================================================================= --> <!-- ============================================================================= -->
<!-- console logging Appender defined -->
<!-- ============================================================================= -->
<!-- ============================================================================= --> <!-- ============================================================================= -->
<!-- file logging Appender defined --> <!-- file logging Appender defined -->
@ -54,13 +52,7 @@
<pattern>${FILE_LOG_PATTERN}</pattern> <pattern>${FILE_LOG_PATTERN}</pattern>
<charset>${FILE_LOG_CHARSET}</charset> <charset>${FILE_LOG_CHARSET}</charset>
</encoder> </encoder>
<!--
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
<layout class="kr.xit.core.support.logback.PatternLayoutWithUserContext">
<param name="Pattern" value="%d{yyyy-MM-dd HH:mm:ss.SSS} %session %-5level %logger{10} - %user %msg%n" />
</layout>
</encoder>
-->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${LOG_PATH}/backup/${LOG_FILE}_%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern> <fileNamePattern>${LOG_PATH}/backup/${LOG_FILE}_%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
@ -68,14 +60,6 @@
</timeBasedFileNamingAndTriggeringPolicy> </timeBasedFileNamingAndTriggeringPolicy>
<maxHistory>50</maxHistory> <maxHistory>50</maxHistory>
</rollingPolicy> </rollingPolicy>
<!--
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>${LOG_PATH}}/logs/backup/${LOG_FILE}-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<maxFileSize>500MB</maxFileSize>
<maxHistory>60</maxHistory>
<totalSizeCap>10GB</totalSizeCap>
</rollingPolicy>
-->
</appender> </appender>
<!-- async appender defined --> <!-- async appender defined -->
@ -98,15 +82,21 @@
</filter> </filter>
</appender> </appender>
<!-- ============================================================================= --> <!-- ============================================================================= -->
<!-- file logging Appender defined -->
<!-- ============================================================================= -->
<!-- <!-- ============================================================================= -->
<appender name="LogstashAppender" class="net.logstash.logback.appender.LogstashTcpSocketAppender"> <!-- logging mask defined -->
<remoteHost>127.0.0.1</remoteHost> <!-- ============================================================================= -->
<port>5000</port> <appender name="mask" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
<layout class="kr.xit.core.support.logback.LogbackMaskingPatternLayout">
<maskPattern>\"recveJuminno\"\s*:\s*\"(.*?)\"</maskPattern> <!-- SSN JSON pattern -->
<maskPattern>\"recevAddr\"\s*:\s*\"(.*?)\"</maskPattern> <!-- Address JSON pattern -->
<maskPattern>\"recevDetailAddr\"\s*:\s*\"(.*?)\"</maskPattern> <!-- Address JSON pattern -->
<pattern>%-5p [%d{ISO8601,UTC}] [%thread] %c: %m%n%rootException</pattern>
</layout>
</encoder>
</appender> </appender>
--> <!-- ============================================================================= -->
<!-- ************************************************************************* --> <!-- ************************************************************************* -->
<!-- SQL log : root appender로 로그 전파 - additivity="true" --> <!-- SQL log : root appender로 로그 전파 - additivity="true" -->

@ -1,16 +1,16 @@
package kr.xit.core.support.logback; 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.ArrayList;
import java.util.List; import java.util.List;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import java.util.stream.Collectors;
import java.util.stream.IntStream; import java.util.stream.IntStream;
/** /**
* logback log masking
* <pre> * <pre>
* description : logback log masking
* <appender name="mask" class="ch.qos.logback.core.ConsoleAppender"> * <appender name="mask" class="ch.qos.logback.core.ConsoleAppender">
* <encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder"> * <encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
* <layout class="kr.xit.framework.support.logback.LogbackMaskingPatternLayout"> * <layout class="kr.xit.framework.support.logback.LogbackMaskingPatternLayout">
@ -22,14 +22,6 @@ import java.util.stream.IntStream;
* </layout> * </layout>
* </encoder> * </encoder>
* </appender> * </appender>
* </pre>
*/
/**
* <pre>
* 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 * packageName : kr.xit.core.support.logback
* fileName : ExcloudLogFilter * fileName : ExcloudLogFilter
* author : julim * author : julim
@ -42,7 +34,6 @@ import java.util.stream.IntStream;
* </pre> * </pre>
* @see ch.qos.logback.core.filter.Filter * @see ch.qos.logback.core.filter.Filter
*/ */
/*
public class LogbackMaskingPatternLayout extends PatternLayout { public class LogbackMaskingPatternLayout extends PatternLayout {
private Pattern multilinePattern; private Pattern multilinePattern;
@ -50,7 +41,7 @@ public class LogbackMaskingPatternLayout extends PatternLayout {
public void addMaskPattern(String maskPattern) { public void addMaskPattern(String maskPattern) {
maskPatterns.add(maskPattern); maskPatterns.add(maskPattern);
multilinePattern = Pattern.compile(maskPatterns.stream().collect(Collectors.joining("|")), Pattern.MULTILINE); multilinePattern = Pattern.compile(String.join("|", maskPatterns), Pattern.MULTILINE);
} }
@Override @Override
@ -74,4 +65,3 @@ public class LogbackMaskingPatternLayout extends PatternLayout {
return sb.toString(); return sb.toString();
} }
} }
*/

Loading…
Cancel
Save