As an AEM developer, we try multiple things in our local instance and there is a high chance of instances getting corrupted once in a while. Ever wondered how easy it is to restore AEM instances using the journal log? If not, then this blog is for you.
This blog describes how to restore our AEM instance to a specific time using the Journal log. The default configuration of the journal theoretically allows for an unlimited number of rotated log-files. Due to some older issues in Oak or some inconsistencies in the repository, a segment can go missing and repository might be inconsistent.
Steps to Implement the Journal Log in AEM
Usually the journal log file is located under /crx-quickstart/repository/segmentstore and the entries in the journal log have epoch timestamp (Unix timestamp ex: 1592560809149, 1592560959133).
1. Stop the AEM instance.
2. Open the journal log file and copy the last epoch time stamp entry and convert to human readable time stamp using https://www.epochconverter.com/ .
3. Identify the time frame when your AEM was running fine. There are couple of ways to do it. Two of them are:
-->a. Run the consistency check
java -jar oak-run-*.jar check -d1 –bin=-1 -p crx-quickstart/repository/segmentstore/
After you run this command in terminal, look for the log entry which says “Found latest good revision: a0bf25e0-7c8b-44c7-acca-7a8066e83107:206” and then try to find this entry in journal log and delete all the entries beneath.
-->b. Randomly try to find the nearest epoch time stamp from the journal log which matches our time frame when AEM was in good condition (like 1 day ago or 2 ago days ago) and then delete the bottom entries from the log.