# AEM Cloud Service Log Tailing: Troubleshooting and Monitoring Tips

Tailing AEM (Adobe Experience Manager) logs in AEM Cloud Service is a common task for troubleshooting and monitoring purposes. AEM Cloud Service is a managed service provided by Adobe that runs AEM in a cloud environment, and accessing logs may differ slightly from an on-premises setup. Here's a general process to tail AEM logs in AEM Cloud Service:

So, here are the steps to go through to tail logs on an AEM as a Cloud Service environment:

**Step 1: Set up Adobe I/O CLI**

Launch the Command Prompt/Terminal and install Adobe I/O CLI. More details on [Adobe IO CLI here](https://github.com/adobe/aio-cli-plugin-cloudmanager)

Check whether Node is installed or not if it's not please install. More details on installation [Node](https://nodejs.org/en/download/package-manager)

```plaintext
$ npm install -g @adobe/aio-cli
```

Post Install of adobe/ aio-cli

```plaintext
$ aio info
output: - 
rj00752505@BGINCHAMLP00792 ~ % aio info

  System:
    OS: macOS 13.4.1
    CPU: (10) arm64 Apple M1 Pro
    Memory: 87.38 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Virtualization:
    Docker: Not Found
  npmGlobalPackages:
    @adobe/aio-cli: 9.3.0
```

**Step 2: Configure the Adobe IO Cloud Manager CLI Plugin**

Installation

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

Updating

```plaintext
$ aio plugins:update
```

**Step 3: Authentication**

a) Browser-Based Authentication - Browser-based authentication starts by running this command.

```plaintext
aio auth:login
```

This command will open a browser window in which you will authenticate using your Adobe Identity.

***Note:*** *You can choose any type of authentication*\*\*\*.\*\*\*

b) [S](https://github.com/adobe/aio-cli-plugin-cloudmanager#service-account-authentication)ervice Account Authentication To use a service account authentication, an integration (aka project) must be created in the [Adobe I/O Console](https://console.adobe.io/) which has the Cloud Manager service.

*The required type of* [*server-to-server authentication*](https://developer.adobe.com/developer-console/docs/guides/authentication/ServerToServerAuthentication/implementation/)

```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"
}
```

**Step 4: Setting Up the Default Program and Default Environment**

**To Find the Env and Program id** - Navigate to [my.cloudmanager.adobe.com](http://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}”](https://experience.adobe.com/#/@the_cool_name_of_my_company/cloud-manager/home.html/program/%7BPROGRAM_NUMBER%7D%E2%80%9D)

```plaintext
$ aio config:set cloudmanager_programid 34562 // setting up default program
$ aio config:set cloudmanager_environmentid 124551 //setting up default env
```

**Useful Command**

1. To List list all the program
    

```yaml
$ aio cloudmanager:list-programs

 Program Id    Name                Enabled 
 ────────── ───────────────────── ───────  
 43674       sandbox-B2c              true    
 34562       sandbox-B2b              true
```

1. To List all the Environments
    

```yaml
$  aio cloudmanager:list-environments 

 Environment Id Name                                  Type  Description       
 ────────────── ───────────────────────────────────── ───── ─────────────────
 124551          demo                          dev   dev environment n          
 9845628         demo-prod                     prod  prod   This is prod env.
```

1. To List list all the log-options
    

```yaml
$ aio cloudmanager:list-available-log-options 124551 
 Environment Id Service            Name          
 ────────────── ────────────────── ───────────── 
 124551         preview_dispatcher httpdaccess   
 124551         preview_dispatcher httpderror    
 124551         preview_dispatcher aemdispatcher 
 124551         author             aemaccess     
 124551         author             aemerror      
 124551         author             aemrequest
```

4)To Tailing the Author error log

```yaml
$  aio cloudmanager:tail-log 121351 author aemerror
25.09.2023 15:34:56.428 [cm-p33452-e121351-aem-author-54c7ddc56c-vf8vb] *INFO* [sling-oak-observation-5] com.adobe.cq.ups.user.utils.UserCreationListener UPS Feature is disabled
25.09.2023 15:34:56.452 [cm-p33452-121351-aem-author-54c7ddc56c-vf8vbJ *INFO* [188.24.112.253 [1695656096450] GET /mnt/overlay/granite/ui/content/shell/header/actions/pulse.data.jsonHTTP/1.11com.day.ca.wcm.core.imp1.designer.searchPathlimiter
Search path limiter configured with searchPathLimiterFeatureToggleOn: true and searchPathThreshold: true
25.09.2023 15:34:56.469 [cm-p33452-e121351-aem-author-54c7ddc56c-vf8vb] *INFO* [188.24.112.253 [1695656096468] GET /mnt/overlay/granite/ui/content/shell/header/actions/pulse.data.jsonHTTP/1.11com.day.cq.wcm.core.imp1.designer.SearchPathLimiter
Search path limiter configured with searchPathLimiterFeatureToggleOn: true and searchPathThreshold: true.
```

Similarly, you can tail any logs.

If you have any questions, please don't hesitate to ask! [Linkedin](https://www.linkedin.com/in/raushan-jaiswal-79653392/)
