How to Tail Cloud Manager Build Logs on AEM as a Cloud Service and AMS
What AEM’s Cloud Manager looks like while deploying to AEM as a Cloud Service
IMPORTANT: Logging Caveats & Limitations
There are currently a few caveats & limitations (subject to change of course) to tailing the build logs with Adobe I/O:
- You can only tail the “Build & Unit Testing” Step: The only execution log that you can tail is the “Build & Unit Testing” step where your code is checked out, built & tested. This applies also to the “web-tier” pipeline. This means that you can’t get a step-by-step tail of the code quality testing step, or output if it fails & is waiting for user interaction. Additionally, the step where the code is actually deployed and put onto your servers is not able to be tailed on the cloud service, despite this being a sometimes 45-minute-long execution step.
- Logs Not Included in Splunk: These logs that you tail are not included in the Splunk output that you get should you opt to send your AEM Cloud Service logs to Splunk (see article for details). This means that until we figure out a way to pipe AIO logs tailing directly into Splunk, there is no way to correlate timestamps to log output should you want to see how one build compared to another build, etc.
So, here are the steps to go through to tail logs on an AEM as a Cloud Service environment:
Step 1: Adobe IO Access for Cloud Manager
The first step you’ll want to check is to make sure your Adobe account is provisioned with access to create a service integration on Adobe IO with Cloud Manager. If you go to https://console.adobe.io with your Adobe ID and create a new project, select “Add an API”. You should see “Cloud Manager” under Experience Cloud in the list of integrations available to you.
What the Adobe IO console should look like if you have Cloud Manager access
If you don’t see Cloud Manager in there (like I didn’t, at first) send an email either to your Adobe Sales rep or to SPP Help (in the case of a Sandbox instance) who can get you sorted.
Step 2: Create an Adobe IO Project for your Cloud Manager (and logs) Access
You’ll then need to create a public/private keypair which generates a new service account (JWT) credential, which you’ll use later on to make your Adobe IO console authenticate to your Cloud Manager env as you. Make sure to save this public/private keypair on your local, as you will need it shortly.
Then, tell the integration what services it will get access to:
And then hit “SAVE CONFIGURED API”.
Step 3: Install the Adobe IO Runtime
This page gives the full installation instructions for installing the Adobe IO runtime. But in short, after installing NodeJS on your workstation, you:
$ npm install -g @adobe/aio-cli
Post install, you should see:
$ aio -v
@adobe/aio-cli/3.5.0 win32-x64 node-v12.18.0
Step 4: Install & Configure the Adobe IO Cloud Manager CLI Plugin
The full install instructions are here, but in short, run:
$ aio plugins:install @adobe/aio-cli-plugin-cloudmanager
Then, after that is installed, you’ll need to get the elements from the Adobe IO integration you created, and paste them into a config.json file which you can use to configure cloud manager. It will consist of:
//config.json
{
"client_id": "value from your CLI integration (String)",
"client_secret": "value from your CLI integration (String)",
"jwt_payload": { value from your CLI integration (JSON Object Literal) },
"token_exchange_url": "https://ims-na1.adobelogin.com/ims/exchange/jwt"
}
Put that file on your workstation, then run the following to configure the credentials:
aio config:set jwt-auth PATH_TO_CONFIG_JSON_FILE --file --json
Then tell it about your private certificate which you saved from Adobe IO above:
aio config:set jwt-auth.jwt_private_key PATH_TO_PRIVATE_KEY_FILE --file
Step 5: Tell AIO what your Default Program Is
Next, tell the Adobe IO runtime what your “Default Program” is. In AEM as a Cloud Service, the “Program” is the collection of environments that make up a single web property. Navigating to my.cloudmanager.adobe.com, you’ll see a URL after logging in like “https://experience.adobe.com/#/@the_cool_name_of_my_company/cloud-manager/home.html/program/{PROGRAM_NUMBER}”
That number at the end is your program number, and you can tell AIO about it like this (assuming “1234” is your program ID):
$ aio config:set cloudmanager_programid 1234
Step 6: Start Your Build from AIO & Copy Build ID
View a list of available pipelines by using the aio cloudmanagerlist-pipelines command:
tad@tad-Precision-7750:~/OneDrive/ICF/aio/config$ aio cloudmanager:program:list-pipelines
Pipeline Id Name Status
─────────── ──────────────────────────────────────── ──────
7239327 Web-Tier Only BUSY
4042555 Non-Production Pipeline IDLE
1023673 Non-Prod Code Only- DEV IDLE
299672 Non-Production Code Quality Pipeline[PT] IDLE
298825 Production Pipeline IDLE
298163 Non-Production Pipeline IDLE
Let’s say you’re going to want to tail the build log of your full-stack non-prod pipeline. In this case, the pipeline ID is “4042555” in the list above.
You can then start that pipeline by using the aio cloudmanagercreate-execution command:
tad@tad-Precision-7750:~/OneDrive/aio/config$ aio cloudmanager:pipeline:create-execution 4042555
starting execution... started execution ID 4042555
Then, you can see that the execution is started with the aio cloudmanagerlist-current-executions command:
tad@tad-Precision-7750:~/OneDrive/aio/config$ aio cloudmanager:program:list-current-executions
Pipeline Id Execution Id Started At Execution Status Trigger Current Step Action Current Step Status
─────────── ──────────── ───────────────────── ──────────────── ─────── ─────────────────── ───────────────────
4042555 198305 March 8, 2022 3:50 PM RUNNING MANUAL Build RUNNING
Step 7: Tail your build log with AIO
Then, once the execution has started, you can use the command aio cloudmanagertail-step-log with the build ID to tail your build logs:
tad@tad-Precision-7750:~/OneDrive/aio/config$ aio cloudmanager:execution:tail-step-log 4042555
2022-03-09T00:15:38+0000 The following build artifacts were reused from the prior execution 1132597 of pipeline 4043554 which used commit 38xxxfe09abc93e08073fa1735924f164:
2022-03-09T00:15:38+0000 * build/mycorp.all-1.0.0-SNAPSHOT.zip (content-package)
2022-03-09T00:15:38+0000 * build/core-components-accelerator.all-1.0.0-SNAPSHOT.zip (content-package)
2022-03-09T00:15:38+0000 * build/mycorp.it.tests-1.0.0-SNAPSHOT-jar-with-dependencies.jar (functional-tests)
And there you go! Let me know if you run into any trouble, or if you DO end up figuring out a way to get those logs into Splunk!
About The Author
Tad Reeves
Principal Architect at Arbory Digital
AEM Architect & DevOps guy with 14 years experience on AEM/CQ and 25+ years in systems infrastructure.
Like what you heard? Have questions about what’s right for you? We’d love to talk! Contact Us
Podcast Episodes
Podcast: The Crossroads of AEM Platform Choices - AEM 6.5 vs AEMaaCS vs EDS
Arbory Digital now has a technical AEM Podcasts! Raf & Tad dive into how to decide you have the right digital experience platform
Is Self-Hosted Aem Still A Thing?
Is it still possible (or advisable) to host Adobe Experience Manager outside of Adobe? Tad Reeves and Joey Smith get into it!