Expand my Community achievements bar.

SOLVED

Sling Logs not capturing Content Fragment Logs

Avatar

Level 1

Enable automated logging when changes are made to the content fragments and the logs should include the AEM User, time, date & changes made. When I tried to create a custom log in sling loggers and provided the path but no loggers appeared. Can please suggest?

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi,

OOTB AEM provides audit logs for assets; however, I’m not sure if this includes content fragments. You can find more information on the OOTB options here:


https://experienceleague.adobe.com/en/docs/experience-manager-65/content/sites/administering/operati...
https://exadel.com/news/viewing-aem-audit-log-without-acs-commons/

 

If you need to create a log with more detailed information, you’ll need to write something custom. I don’t think simply attaching classes to a new logger will provide the desired output. Instead, you’ll need to implement a custom process for logging. One approach is to create a workflow launcher that listens for changes on your Content Fragment’s path and triggers a custom workflow to write the required log.

 

Here are some useful resources:

https://experienceleague.adobe.com/en/docs/experience-manager-65/content/sites/administering/operati...

https://experienceleague.adobe.com/en/docs/experience-manager-learn/forms/adaptive-forms/custom-proc...

https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/audit-log-with-extra-infor...

 

 

Hope this helps!



Esteban Bustamante

View solution in original post

6 Replies

Avatar

Administrator

@EstebanBustamante@TarunKumar@kapil_rajoria@Himanshu_Jain@Raja_Reddy@Veena1@chinmayis865517@Sh1ju@Preetpal_Bindra@RahulMohan

Kindly take a moment to review this question and share your valuable insights. Your expertise would be greatly appreciated!



Kautuk Sahni

Avatar

Correct answer by
Community Advisor

Hi,

OOTB AEM provides audit logs for assets; however, I’m not sure if this includes content fragments. You can find more information on the OOTB options here:


https://experienceleague.adobe.com/en/docs/experience-manager-65/content/sites/administering/operati...
https://exadel.com/news/viewing-aem-audit-log-without-acs-commons/

 

If you need to create a log with more detailed information, you’ll need to write something custom. I don’t think simply attaching classes to a new logger will provide the desired output. Instead, you’ll need to implement a custom process for logging. One approach is to create a workflow launcher that listens for changes on your Content Fragment’s path and triggers a custom workflow to write the required log.

 

Here are some useful resources:

https://experienceleague.adobe.com/en/docs/experience-manager-65/content/sites/administering/operati...

https://experienceleague.adobe.com/en/docs/experience-manager-learn/forms/adaptive-forms/custom-proc...

https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/audit-log-with-extra-infor...

 

 

Hope this helps!



Esteban Bustamante

Avatar

Level 1

Hi @EstebanBustamante,

Thanks for your suggestion. I tried with the workflow approach

1. Created workflow process step, Model and Launcher

2. Added new entry in user mapping service amendment and provided necessary service to the user

I am able to log, which cf is modified, User, date & time but not able to log the changes made. I tried to hit the version history, eventhough there is multiple histories, getting error like no histories for the particular node. Can you please suggest?

 

Avatar

Community Advisor

Sorry @NivethaT1, I missed the part where you mentioned that you need to be aware of the changes made. If that's the case, then the workflow approach won't provide what you need. However, you can still use a ResourceChangeListener to monitor the content fragment paths you need, or alternatively, you could use a SlingServlet to capture the values before updating. DO not use EventListener as this is deprecated. The filter approach might be a bit more complex, so explore the ResourceChangeListener first, here is a good example of what you need to do: https://techrevel.blog/2017/03/15/resourcechangelistener/ 

 

Additional Resources: https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/clarification-eventlistene...

Sling Filter: https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/how-to-log-monitor-user-ac... 

 

Hope this helps



Esteban Bustamante

Avatar

Community Advisor

@NivethaT1 

 

Out of Curious... What do you mean by automated logging?


Aanchal Sikka

Avatar

Level 7

Hi @NivethaT1 ,
For this "logging when changes are made to the content fragments and the logs should include the AEM User, time, date & changes made" you can go with the following options:
1. Create a custom event listener and use a logger in that file.
2. Create a custom workflow or sling job use a logger in that file.
In any of the above approach, you can check the logs output here: http://localhost:4502/system/console/slinglog or search it in the error.log file present inside crx-quickstart > logs
3. Use AEM Audit Logs or create an custom Audit log:

AEM provides built-in audit logging capabilities that can be configured to track changes to Content Fragments. In case you are creating a custom Audit log, you can use a logger in that file and use the same process stated above to see the logs.

Please let me know, in which file you put the logs along with its description.