AEM Log files

  1. Access.log: It capture maximum information including IP, username, time stamp, request method, token information, request protocol, response code, which page we have requested and browser details
  2. Request.log: It has few information like- time stamp, which page we have requested, request method, response code and how much time to get a responded.
  3. History.log: This log basically stored the information, which pages we have visited and what purpose (eg: VIEW, EDIT etc) with time stamp and by which user.
  4. Error.log: This log is basically used for debugging the server side code. It shows the error, info, warn and debug logs for all the projects.
  5. Stdout.log: This log file shows the information about AEM startup details (eg: which time AEM has started, which port, runmode is used etc).
  6. Stderr.log: This log file is used to show if any error occurred during AEM startup.

Create a content fragment and it’s variations in AEM

What is content fragments?

Content fragment has been introduced in AEM6.2. It allow us to create, design and page independent content. It’s store as an Asset so, it is managing through Asset console. It’s allow to use in multiple location or channels eg: mobile site, desktop site etc. Content Fragments do not contain any layout and design. Content fragments are not available in the classic UI.

Since AEM6.4 it can deliver in JSON format, using Sling Model export capabilities in AEM core components. AEM Content Fragments can be used to describe and manage structured content. Structured content is defined in models that can contain a variety of content types; including text, numerical data, boolean, date and time, and more. Learn more about content fragment.

Types of Content Fragments

Content fragments are available in two types.

  • Simple fragments
    • It does not have customized structure, It contains only text and images.
  • Fragment contains structure contents
    • Based on content fragment model. we can customize the structure.

Variation

Variations are copy of master content fragment and can be edit the content inside variation. It is using for specific channel and authoring as per requirement. eg: Mobile site variation or email variation.

Create a content fragment

To create a content fragment perform below steps:

  1. Go to AEM Start> Assets > Files
  2. Or click to open AEM asset view http://localhost:4502/assets.html/content/dam
  3. Create a folder “Demo Folder”
Demo Folder

4. Now inside the “Demo Folder” create content fragment

create content fragment

5. Select the “Simple Fragment” template and click the Next.

6. Specify “Demo content fragment” as the title and “Example of content fragment” as the description and click create.

Content fragment

Edit text in content fragment

Select Demo content fragment and click edit the fragment. Then add text inside the fragment and click save.

content fragment text

Create a variation

We can create multiple variations of channel specific which will use in different AEM application.

Let see how to create variation. There are few steps:

  1. Click on create variation in left and provide name for variation. eg: Mobile view
    Mobile view variation

  2. Now add text content specific to mobile view and click save.
    Mobile view content

SQL2 Query | AEM

Fetch users node

SELECT * FROM [rep:User] As user WHERE ISDESCENDANTNODE(user, ‘/home/users’) AND [rep:authorizableId] <> ‘anonymous’ AND [jcr:primaryType] <> ‘rep:SystemUser’ AND [rep:authorizableId] NOT LIKE ‘%@%’ ORDER BY [rep:authorizableId] ASC

Search node having specific resourceType

SELECT * FROM [nt:unstructured] As node WHERE ISDESCENDANTNODE(node, ‘/content’) and [sling:resourceType] LIKE  ‘%components/page/site’

Find the pages which does not have [cq:tags] property

select * from [cq:PageContent] as page where ISDESCENDANTNODE(page,’/content/corporate/news’) AND page.[cq:tags] is null

Find the page and its node who has matching component

select * from [nt:unstructured] as page where ISDESCENDANTNODE(page, ‘/content’) and [sling:resourceType] like ‘%components/content/accordion’

Find the projects/Website name where the specific component is exist

select * from [cq:Component] as node where ISDESCENDANTNODE(node, ‘/apps’) and name() =’accordion’

Find the template name where particular component is used

select * from [nt:unstructured] as page where ISDESCENDANTNODE(page, ‘/apps’) and [sling:resourceType] like ‘%accordion’

Find all templates in apps folder

select * from [cq:Template] as page where ISDESCENDANTNODE(page, ‘/apps’)

Find all pages which created by specific template

select * from [cq:PageContent] as page where ISDESCENDANTNODE(page, ‘/content/corporate’) and [cq:template] =’/apps/corporate/templates/home-page’

Download and upload aem packages using shell script

Using shell script you can download packages from source instance and upload into destination instance

# packages.txt 
service pack: aem-service-pkg-6.5.4.zip 
AEM forms: AEM-Forms-6.5.4.0-OSX-6.0.138.zip
#!/bin/bash
FILE="/home/prahlad/packages.txt"
TEMP="/home/prahlad/temp"
crx_packmgr_path="/etc/packages/adobe/cq650/servicepack"
source="localhost:4502"
dest="localhost:4503"
# create temp folder.
mkdir $TEMP
# start loop to read file and execute command for each line .
while IFS= read -r line
do
package_name=`echo "$line" | awk '{split( $0,array, ":"); print array[2]}'`
# download packages from source server.
echo $source $crx_packmgr_path $package_name $TEMP | awk '{print("curl -u admin:admin http://"$1 "" $2 "/" $3 " > " $4 "/" $3)}' | sh
wait $!
# upload and install package into destination server.
echo $package_name $dest $TEMP | awk '{print("curl -u admin:admin -F file=@" $3 "/" $1 " -F name="$1" -F force=true -F install=true http://"$2"/crx/packmgr/service.jsp")}' | sh
wait $!
done <"$FILE"
AEM 6.4 upgrade

AEM Upgrade

I have upgrade from AEM 6.2 to 6.4 one of my reputed client. This article covers both upgrade strategies and steps required to do them successfully.

Pre-requisite steps for upgrade

  • Release notes
  • Technical Requirements
    • Adobe recommended lists the supported client and server platforms for Adobe Experience Manager which need to upgrade.
Application/ServerVersion
AEM6.4
Apache2.4
Dispatcher4.2.2
Jdk1.8.0_221
Oak1.8.2
  • Pre-Upgrade maintenance tasks
    • Before beginning your upgrade, it is important to follow these maintenance tasks to ensure that the system is ready and can be rolled back should issues occur.
      • Execute pattern detector and get the report for where we need to do customization or update.
      • Ensure Sufficient Disk Space
      • Fully Back Up AEM
      • Back Up Changes to /etc
      • Configure Workflow and Audit Log Purging
      • Install, Configure, and Run The Pre-Upgrade Tasks
      • Execute Offline Revision Cleanup
      • Execute Data store Garbage Collection
      • Rotate Log Files

Upgrade approaches

There are two type of upgrade approaches
  • In place upgrade
  • Fresh Installation

In Place Upgrade

  • Stop the existing instance eg: AEM 6.2
  • Remove log files from environment
  • Take a backup of quickstart folder
  • Run Offline revision cleanup or offline compaction
    • Download correct oak-run jar compatible with AEM6.2 from below URL https://repo1.maven.org/maven2/org/apache/jackrabbit/oak-run/
    • Shutdown AEM if running
    • (Optional) Use the tool to find old checkpoints: java -jar oak-run-1.4.9.jar checkpoints install-folder/crx-quickstart/repository/segmentstore
    • (Optional) Then, delete the unreferenced checkpoints: java -jar oak-run-1.4.9.jarr checkpoints install-folder/crx-quickstart/repository/segmentstore rm-unreferenced
    • Run the compaction and wait for it to complete: java -jar -Dlogback.configurationFile=logback.xml -Xmx8g oak-run-1.4.9.jar compact install-folder/crx-  quickstart/repository/segmentstore
    • After executing compaction the repository size has been reduced from 19 GB to 2.69 GB
    • Replace AEM6.2 jar with AEM 6.4
    • Preparation of the AEM quickstart jar file java -Xmx4096m -jar aem6.4_quickstart-author-p4502.jar –unpack
    • Execute repository migration command java -Xmx4096m -jar aem6.4_quickstart.jar -v -x crx2oak -xargs — –load-profile segment-no-ds
    • Determine the correct upgrade start command. After migrate start AEM with below command java -Xmx8g -Djava.awt.headless=true -Dsling.run.modes=author,crx3,crx3tar -jar aem6.4_quickstart.jar -p 4502 -verbose -nofork -gui -Dsling.properties=conf/sling.properties

Fresh Installation

Software Installation:

Be sure to install and configure the following:
  • Install AEM using the version 6.4 JAR file. (AEM_6.4_Quickstart.jar)
    • Copy your Jar file in your dev location.
      • You will also need to copy in the license.properties file.
      • Double clicking the jar file will install and launch the server.
      • See Debugging for launching the server in debug mode so you can debug using your IDE.
    • Local Author instance should be running on port 4502 (AEM_6.3_Quickstart.jar)
  • Java/JRE 1.8: http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
    • From command line, run ‘java -version’ to confirm your java version is 1.8
  • Apache Maven 3.5.3: http://archive.apache.org/dist/maven/maven-3/3.5.2/binaries/
    • From command line, run ‘mvn -version’ to confirm your maven version is 3.X
    • Make sure you download the binary.
  • Eclipse latest version (java EE): https://www.eclipse.org/downloads/
    • NOTE: Those who have an IntelliJ license or prefer another IDE may use then but note that this document will not support the setup

Post Upgrade Checks

  • Repository is migrated properly. (Below completion message will appear)

(05.06.2018 09:26:28.353 INFO   c.a.g.c.e.MigrationRunner: migration completed )

 __   __         __        ___ ___  ___  __

/  ` /  \  |\/| |__) |    |__   |  |__  |  \

\__, \__/  |  | |    |___ |___  |  |___ |__/

  • Oak version is 1.8.2
Oak version
  • Check product info
AEM product info
  • Check the runmode
Apache sling settings
  • AEM 6.4 system overview
AEM system info
  • Site.html, login.html is working
  • Crxde , crx explorer, felix console are working
  • Some of the dependencies has been changed in pom files
aem-maven-tooling/global-parent/pom.xml

<dependency>
        <groupId>com.adobe.aem</groupId>
       <artifactId>uber-jar</artifactId>
       <version>6.2.0</version>   DELETED
       <version>6.4.0</version>   ADDED
       <classifier>apis</classifier>
       <scope>provided</scope>
</dependency>

acs-commons version modified

<acs-aem-commons.version>3.13.0</acs-aem-commons.version>  DELETED

<acs-aem-commons.version>3.17.0</acs-aem-commons.version>  ADDED