Log data Masking in AEM | Community
Skip to main content
you-09089
October 16, 2015
Solved

Log data Masking in AEM

  • October 16, 2015
  • 4 replies
  • 1553 views

I want to mask user data so i need to create a service config where i can create more than one regex and the service should match the regex and mask the data in log file.

How we can achieve in AEM ?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by joerghoh

Hi,

in case of AEM 6 you will have logback as logging implementation. I am not familiar with logback at all, but I think, that there are ways to post-process log statements, so masking user data should be possible. [1] can give you a starting point.

kind regards,
Jörg

[1] https://sling.apache.org/documentation/development/logging.html#logback-integration

4 replies

smacdonald2008
Level 10
October 16, 2015

"I need to override the OOTB logger service"

See these AEM doc topics for information:

https://docs.adobe.com/docs/en/cq/5-6-1/deploying/configure_logging.html

http://docs.adobe.com/docs/en/cq/5-6-1/deploying/monitoring_and_maintaining.html#Create a Custom Log File

See:

Name: org.apache.sling.commons.log.names
Type: String[] (String + Multi)
Value: specify the OSGi services for which the Logger is to log messages; for example, all of the following:

  • org.apache.sling
  • org.apache.felix
  • com.day

You can write a log service - that is where you need to inject Java app logic to meet your mask requirements. 

you-09089
you-09089Author
October 16, 2015

I need to override the OOTB logger service in which i have to add my regex configuration where author can configure log file name. pattern matching for logging and other OOTB configuration. How can i override the default one so that my service should get picked.

joerghoh
Adobe Employee
joerghohAdobe EmployeeAccepted solution
Adobe Employee
October 16, 2015

Hi,

in case of AEM 6 you will have logback as logging implementation. I am not familiar with logback at all, but I think, that there are ways to post-process log statements, so masking user data should be possible. [1] can give you a starting point.

kind regards,
Jörg

[1] https://sling.apache.org/documentation/development/logging.html#logback-integration

smacdonald2008
Level 10
October 16, 2015

Create an OSGi bundle and deploy. Are you new to writing OSGi bundles?  If so -- read:

https://helpx.adobe.com/experience-manager/using/first-osgi.html

Because the OSGi bundle is implemented as  Java - you can use Java to perform a Mask. Here is a Stackoverflow of how to mask in Java:

http://stackoverflow.com/questions/12148281/mask-string-with-characters

If you need to get/read AEM user data - then use Jackrabbit API in the service. 

Using Jackrabbit UserManager APIs to create AEM Users and Groups

Developing AEM OSGi bundles that use Jackrabbit UserManager APIs