Tailing Logs on AEM as a Cloud Service

Tailing Logs on AEM as a Cloud Service

June 9, 2020 2 By Tad Reeves

In order to monitor or debug AEM environments (or virtually any web environment) one needs data, and that data generally comes from server logs. Adobe’s new AEM as a Cloud Service product, given that it’s entirely a managed web service, does not give you the ability to SSH on to individual containers to view logs, nor does it give you access to any sort of Splunk or Elastic or similar log aggregator.

At this point, to get access to your AEM logs is one of two ways:

  1. You can download whole logs out of Cloud Manager, and view them on your local, or
  2. You can use the Adobe I/O Cloud Manager CLI to tail logs on any of your AEM as a Cloud Service instances.

Note: there is a current issue with both the Adobe IO CLI as well as Cloud Manager’s log downloads, that large stack traces will currently be truncated, a limitation coming from the internal Splunk integration that the AEM as a Cloud Service infra uses on the back end to aggregate the logs. (The Adobe team uses Splunk themselves at this stage, but the capability hasn’t been added to turn this over to end users).

That being said, it’s still extremely useful to be able to tail logs on any AEM instance, even if one isn’t able to do critical time-correlation, graphing, historical queries, and all the other things you do with a log aggregator. 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:

Post install, you should see:

Step 4: Install & Configure the Adobe IO Cloud Manager CLI Plugin

The full install instructions are here, but in short, run:

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:

Put that file on your workstation, then run the following to configure the credentials:

Then tell it about your private certificate which you saved from Adobe IO above:

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):

Step 6: List your Environments

Then, running the following command will list the environments in your program that you have access to:

Step 7: List Logs from an Environment

Note the number that each of your environments have as an Environment ID. If you use this ID you can list what logs are available for that environment:

Step 8: Tail the Desired Log

It’s cumbersome, it has a lot of steps, and no, it’s not Splunk. But it’s far better than nothing and is definitely needed if you’ll be doing any sort of development work on the instance.

Hopefully this helps you out!