# Arc XP CLI: PageBuilder Engine Logs Package

Source: https://dev.arcxp.com/pagebuilder-engine/core-concepts/pagebuilder-engine-logs-cli/

The Arc XP CLI is your command center for streamlining development and automating key workflows. Retrieve PageBuilder Engine logs through the @arcxp/cli npm package for lightweight, self-service troubleshooting.

> **Note:**
> 
> To get the Arc XP CLI running locally, follow [this guide](https://dev.arcxp.com/arcxp-cli), then continue here for PageBuilder-specific instructions.

The PageBuilder package pulls Engine logs for a specific request ID. It’s a lightweight, self-service tool built to help you troubleshoot your pages efficiently. The documentation below covers this option.

For deeper analysis—like dashboards, alerts, and full log visibility across environments—you can forward logs to your own AWS instance. See the [PageBuilder Engine log forwarding](https://dev.arcxp.com/pagebuilder-engine/developer-docs/pagebuilder-engine-log-forwarding/) guide for details.

### Access Controls

A read-only access token for each environment where you want to view logs is required. You can obtain tokens from Developer Center as described [here](https://docs.arcxp.com/en/products/arc-xp-administration/developer-center/managing-access-tokens.html#UUID-49aed608-266c-7c6c-e1bd-7021f29e25c6%5FUUID-be1143e5-38ed-4ff5-7fd8-d7425f51e8c8).

## Viewing Logs

Once you have installed the CLI and set up your environment access controls, you can view the PageBuilder Engine logs using the command line. The command will prompt you to enter a request ID, which you can find in your browser console.

### 1\. Copy request ID from browser console

On a page where you are experiencing issues:

1. Open your browser’s developer tools (F12 / fn + F12 or right-clicking and selecting “Inspect”).
2. Navigate to the “Network” tab, find the header name for the page with the issue.
3. Copy the first `X-Arc-pb-request-id` from the “Headers” details.

> **Note:**
> 
> Typically the first `X-Arc-pb-request-id` from the “Response Headers” list will return Engine logs. If results are not found, try the second request ID.

![PageBuilder Engine Logs Request ID](https://dev.arcxp.com/images/pagebuilder-engine/pagebuilder-engine-logs-request-id.png)

### 2\. Run command with request ID

In your terminal:

1. Select `pagebuilder` from the product list.
2. Select `view-logs` as the action.
3. Paste the copied request ID when prompted.

> **Note:**
> 
> Logs should be requested within 15 minutes of the request ID being generated. If you are unable to retrieve logs, refresh your browser and copy the latest ID.

![Arc XP CLI in Terminal](https://dev.arcxp.com/images/pagebuilder-engine/arcxp-cli-pagebuilder-engine-logs-prompt.png)

### 3\. View logs

All logs for the provided request ID will be displayed in your terminal. See [How to Read Engine Logs](https://dev.arcxp.com/pagebuilder-engine/developer-docs/how-to-read-engine-logs/) for more information on interpreting the logs. ![PageBuilder Engine Logs in Arc XP CLI](https://dev.arcxp.com/images/pagebuilder-engine/pagebuilder-engine-logs-cli.png)

> **Tip:**
> 
> As a best practice, you can implement your own [error logging](https://dev.arcxp.com/pagebuilder-engine/developer-docs/profiling-code-performance-and-arc-xp/#logs/) in your custom blocks code for easier troubleshooting.

## Rate Limits

Throttling is applied to the log retrieval API call: `/pagebuilder/api/v1/logsearch`

- The log retrieval call is limited to 40 requests per minute.

## CLI Error Reference

Below are common errors you may encounter when using the CLI to retrieve PageBuilder Engine logs, along with their causes and fixes.

### API Error (400): Bad Request

If you encounter an API error with a 400 status code:

| Cause                                      | Fix                                         |
| ------------------------------------------ | ------------------------------------------- |
| Request is missing the required parameters | Ensure you have provided a valid request ID |

> **Note:**
> 
> White space is automatically trimmed from the request ID in the CLI.

### No logs found for request\_id: `{request_id}`

If you see this message, no logs were found for the provided request ID. This could be because:

| Cause                                                                                                                  | Fix                                                                           |
| ---------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------- |
| Stale request ID that is outside of the 15 minute window for log retrieval                                             | Refresh your browser and copy the latest request ID                           |
| 15 minute [TTL (time to live) cache](https://dev.arcxp.com/caching/overview/) on the article page after a fresh deploy | Append a token to the URL to bypass the cache, and copy the latest request ID |

### Security Warning: permissions set to 644

| Cause                                                                      | Fix                                                                          |
| -------------------------------------------------------------------------- | ---------------------------------------------------------------------------- |
| Expected permissions are not configured on the .env file in your directory | Run chmod 400 and ensure a read only token is set in the correct environment |

## Watch the Demo

[ Play ](https://youtube.com/watch?v=K0GISOPTKPA) 

Arc XP CLI: Troubleshooting Webpage Errors with PageBuilder Engine Logs
