Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

Log data Masking in AEM

Avatar

Level 1

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 ?

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

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

View solution in original post

4 Replies

Avatar

Level 10

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

Avatar

Correct answer by
Employee Advisor

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

Avatar

Level 1

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.

Avatar

Level 10

"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.