@Test public void testLast4Mask(){ String masked = mc.convert(getEvent("username=abc123")); assertEquals("username=ab*****", masked); masked = mc.convert(getEvent("username:abc123")); assertEquals("username:ab*****", masked); masked = mc.convert(getEvent("\"username\":\"abc123\"")); assertEquals("\"username\":\"ab*****\"", masked); masked = mc.convert(getEvent("\"username\":\"abc123\",signature=foo")); assertEquals("\"username\":\"ab*****\",signature=*****", masked); }
@Override public String convert(ILoggingEvent logEvent) { String message = logEvent.getMessage(); Set<Pattern> patternSet = patternMap.keySet(); if (message!=null && !message.equals("")) { for (Pattern pattern : patternSet) { message = pattern.matcher(message).replaceAll(patternMap.get(pattern)); } } return message; }
DefinedRegexMaskingConverter extends ClassicConverter { @Override public String convert(ILoggingEvent logEvent) { String message = logEvent.getMessage(); Set<Pattern> patternSet = patternMap.keySet(); if (message!=null && !message.equals("")) { for (Pattern pattern : patternSet) { message = pattern.matcher(message).replaceAll(patternMap.get(pattern)); } } return message; } }
DefinedRegexMaskingConverter extends ClassicConverter { @Override public String convert(ILoggingEvent logEvent) { String message = logEvent.getMessage(); Set<Pattern> patternSet = patternMap.keySet(); if (message!=null && !message.equals("")) { for (Pattern pattern : patternSet) { message = pattern.matcher(message).replaceAll(patternMap.get(pattern)); } } return message; }  }
DefinedRegexMaskingConverter extends ClassicConverter { @Override public String convert(ILoggingEvent logEvent) { String message = logEvent.getMessage(); Set<Pattern> patternSet = patternMap.keySet(); if (message!=null && !message.equals("")) { for (Pattern pattern : patternSet) { message = pattern.matcher(message).replaceAll(patternMap.get(pattern)); } } return message; }  @Override String convert(ILoggingEvent logEvent); @Override void start(); }
DefinedRegexMaskingConverter extends ClassicConverter { @Override public String convert(ILoggingEvent logEvent) { String message = logEvent.getMessage(); Set<Pattern> patternSet = patternMap.keySet(); if (message!=null && !message.equals("")) { for (Pattern pattern : patternSet) { message = pattern.matcher(message).replaceAll(patternMap.get(pattern)); } } return message; }  @Override String convert(ILoggingEvent logEvent); @Override void start();  }