AEM Cloud Service - Tailing AEM Environment Logs in a Cloud Manager Program


For debugging any issue in AEM the ideal way is to setup a JVM remote debugger, however if that is not an option you could try log tailing....

Following steps explain the setup and tailing an environment log in a cloud manager program using Cloud Manager Plugin for the Adobe I/O CLI. Check it on Github

Tailing logs is also available in an open source implementation of Cloud Manager Desktop




Install the Adobe IO Node.js Application


1) Open command prompt and install Adobe I/O CLI. More details on Adobe IO CLI here

npm install -g @adobe/aio-cli

2) Install the Cloud Manager Plugin. More details on the CM plugin here

aio plugins:install @adobe/aio-cli-plugin-cloudmanager


Setup Service Account Connection (using JWT)


3) Accessing any Adobe product API (here Cloud Manger in Experience Cloud) is achieved using a service account creation in Adobe IO (https://console.adobe.io/). Assuming you have System Administrator or Developer role in the Org (eg. ORG ID: 2FBC7_PURPOSEFUL_OBFUSCATION_95FBB@AdobeOrg) create a project and click on the Add API button (for more details on service accounts integration check documentation)



4) Select Cloud Manager under Experience Cloud



5) Generate a Key pair (private, public key) to exchange access tokens...




6) Public key remains with Adobe IO and the Private key is configured in your application (here Adobe IO command line application)



7) Select the product profiles (features) of Cloud Manager you'd like to use in the CLI application. Your integration's service account will gain access to granular features of the Adobe product based on the product profiles that you select.



8) Make note of the Credentials (for using later in the configuration), click on Generate JWT tab to copy the JWT payload






9) Create a file config.json, copy the client_id, client_secret, jwt_payload values to the config file, for e.g.

{
  "client_id": "bef8a_PURPOSEFUL_OBFUSCATION_2ea5",
  "client_secret": "fdcc_PURPOSEFUL_OBFUSCATION_e46d4",
  "jwt_payload": {"exp":1589039706,"iss":"2FB_PURPOSEFUL_OBFUSCATION_5FBB@AdobeOrg","sub":"6BC_PURPOSEFUL_OBFUSCATION_FA7@techacct.adobe.com","https://ims-na1.adobelogin.com/s/ent_cloudmgr_sdk":true,"aud":"https://ims-na1.adobelogin.com/c/be_PURPOSEFUL_OBFUSCATION_ea5"},
  "token_exchange_url": "https://ims-na1.adobelogin.com/ims/exchange/jwt"
}


Configure Adobe IO CLI


10) Open command prompt and set the config file in Adobe IO app, for eg.

aio config:set jwt-auth ./config.json --file --json



11) Set the private key downloaded in step 6, for eg.

aio config:set jwt-auth.jwt_private_key ./private.key --file



12) Set the cloud manager program id, if you want to avoid passing the program ID flag repeatedly (something like a default program) for eg.

aio config:set cloudmanager_programid 10961





13) Get the services names in an environment of the program, for e.g.

aio cloudmanager:list-available-log-options 19892



14) To tail the error log use aio cloudmanager:tail-log ENVIRONMENTID SERVICE NAME, for e.g.

aio cloudmanager:tail-log 19892 author aemerror
aio cloudmanager:tail-log 19892 dispatcher aemdispatcher


No comments:

Post a Comment