> ## Documentation Index
> Fetch the complete documentation index at: https://docs.germainux.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Deploy Engine Monitoring for Salesforce

> Connect a GermainUX Engine to your Salesforce org through the API to collect Event Monitoring logs, debug logs, org limits, audit, code and instance status.

Components
[`Engine`](https://docs.germainux.com/deploy/germain-ux-engine)

Availability
2017.1 or later

> [card] [Before You Start](#before-you-start)
>
> App, user, network

> [card] [Deploy](#deploy)
>
> Salesforce, then the wizard

> [card] [Validate](#validate)
>
> Components and first data

> [card] [Troubleshooting](#troubleshooting)
>
> Login and data gaps

## Overview

The **Salesforce.com Application Monitoring** wizard connects a GermainUX Engine to one Salesforce org through the Salesforce API. It deploys the components that collect Event Monitoring logs, debug logs, org limits, audit and deployment history, usage statistics, Apex code and coverage, and instance status. For what Salesforce monitoring gives you, see [Salesforce Operational Experience Intelligence](https://docs.germainux.com/integrations/salesforce-monitoring.md). Browser monitoring (RUM JS or RUM Extension) is a separate deployment, described in [Deploy Monitoring for Salesforce](https://docs.germainux.com/integrations/salesforce-monitoring/salesforce-monitoring-deployment.md).

### What the Wizard Creates

The wizard creates these components on the Engine you select. All of them belong to the **Salesforce Application** profile.

| Component | What it does | Default schedule | Details |
| - | - | - | - |
| **Salesforce Event Log Monitor** | Downloads the hourly Event Monitoring log files and processes Login events | Every hour | [Log Monitoring](https://docs.germainux.com/integrations/salesforce-monitoring/salesforce-log-monitoring.md) |
| **Salesforce Event Log Parser** | Turns the other event log files into transactions and events | When a file arrives | [Log Monitoring](https://docs.germainux.com/integrations/salesforce-monitoring/salesforce-log-monitoring.md) |
| **Salesforce Audit Monitor** | Collects org limits, Health Check risks, the Setup Audit Trail, platform event usage and deployments | Every 12 hours | [Audit Monitoring](https://docs.germainux.com/integrations/salesforce-monitoring/salesforce-audit-monitoring.md) |
| **Salesforce Stats Monitor** | Collects licence usage, record counts, processes, custom actions, Lightning usage and cases | Every hour | [Stats Monitoring](https://docs.germainux.com/integrations/salesforce-monitoring/salesforce-stats-monitoring.md) |
| **Salesforce Instance Status Monitor** | Reads your instance's status from Salesforce Trust | Every 12 hours | [Instance Status Monitoring](https://docs.germainux.com/integrations/salesforce-monitoring/salesforce-instance-status-monitoring.md) |
| **Salesforce Code Monitor** | Collects Apex classes, triggers, code coverage and Flow test coverage | Once a day | [Code Monitoring](https://docs.germainux.com/integrations/salesforce-monitoring/salesforce-code-monitoring.md) |
| **Salesforce Debug Log Monitor** | Downloads new Apex debug logs | Every hour | [Debug Log Monitoring](https://docs.germainux.com/integrations/salesforce-monitoring/salesforce-debug-log-monitoring.md) |
| **Salesforce Debug Log Directory Monitor** | Picks up the downloaded debug log files | When a file arrives | [Debug Log Monitoring](https://docs.germainux.com/integrations/salesforce-monitoring/salesforce-debug-log-monitoring.md) |
| **Salesforce Debug Log Parser** | Turns each debug log into code executions, SOQL and DML timings, debug messages and exceptions | When a file arrives | [Debug Log Monitoring](https://docs.germainux.com/integrations/salesforce-monitoring/salesforce-debug-log-monitoring.md) |
| **Salesforce Debug Log Collator** | Adds each debug log's operation and status to its execution | When the parser sends data | [Debug Log Monitoring](https://docs.germainux.com/integrations/salesforce-monitoring/salesforce-debug-log-monitoring.md) |

## Before You Start

* A GermainUX Engine that can reach Salesforce. See [GermainUX Engine](https://docs.germainux.com/deploy/germain-ux-engine.md).
* Outbound HTTPS (port 443) from the Engine to your My Domain host (for example `acme.my.salesforce.com`), to the login host you use (`login.salesforce.com` or `test.salesforce.com`), and to `api.status.salesforce.com` for instance status.
* The Salesforce **Event Monitoring** add-on, for the Event Log Monitor. Without it, Salesforce provides no hourly event log files, and the other components still work.
* A dedicated Salesforce integration user. Make it an API-only user, and don't use a personal administrator account.
* A Salesforce app for the login: an existing **Connected App** for username and password login, or an **External Client App** for JWT bearer login. See [Prepare Salesforce](#prepare-salesforce).
* Two folders on the Engine host with write access: one for event log files and one for debug logs.
* Trace flags in Salesforce for the users whose debug logs you want. GermainUX collects debug logs that already exist and doesn't create trace flags.

### Permissions for the Integration User

Give the integration user these permissions through a permission set:

| Permission | Needed for |
| - | - |
| **API Enabled** | Every component that calls Salesforce |
| **View Event Log Files** | Event Monitoring log files |
| **View Setup and Configuration** | Setup Audit Trail, org limits, deployments, Apex classes and triggers, code coverage, licences |
| **View Health Check** | Health Check risks |
| **View All Data** | Debug logs of other users, and case history for case monitoring |
| **API Only User** | Keeps the account from logging in to the Salesforce UI |

## Deploy

### Prepare Salesforce

Salesforce supports two logins for this integration. The wizard sets up username and password login. JWT bearer login uses a certificate instead of a password, and you switch the components to it after you run the wizard.

> [tab] Username and Password
>
> Use this login with an existing Connected App. Salesforce no longer lets you create new Connected Apps, External Client Apps don't support this login, and Salesforce retires the OAuth username-password flow on February 20, 2027. For a new setup, use JWT bearer login.
>
> **1. Allow the username-password flow**
>
> In Salesforce Setup, open **OAuth and OpenID Connect Settings**, and turn on **Allow OAuth Username-Password Flows**. Orgs created recently block this flow by default.
>
> **2. Check the Connected App**
>
> In **App Manager**, open the Connected App you use for GermainUX. Make sure **Enable OAuth Settings** is on and the selected scopes include **Manage user data via APIs (api)**. Note the **Consumer Key** and **Consumer Secret**.
>
> **3. Authorize the integration user**
>
> Under **Manage Connected Apps**, edit the app's policies. Set **Permitted Users** to **Admin approved users are pre-authorized**, and add the integration user's permission set.
>
> **4. Decide on IP restrictions**
>
> Either set **IP Relaxation** to **Relax IP restrictions** for the Engine's IP address, or append the user's security token to the password when you create the credentials in GermainUX.

> [tab] JWT Bearer
>
> Use this login for new setups. You need an RSA key pair: the certificate goes to Salesforce, and the private key goes to GermainUX.
>
> **1. Create a key pair and certificate**
>
> Create an RSA private key in unencrypted PKCS#8 format (it starts with `-----BEGIN PRIVATE KEY-----`) and a certificate for it:
>
> ```bash Create the Key and Certificate theme={null}
> openssl req -x509 -newkey rsa:2048 -nodes -days 730 \
>   -keyout germainux-salesforce.key -out germainux-salesforce.crt \
>   -subj "/CN=GermainUX Salesforce Monitoring"
> ```
>
> Keep `germainux-salesforce.key` secret. You enter its content in GermainUX.
>
> **2. Create an External Client App**
>
> In Salesforce Setup, open **External Client App Manager** and create an app. Under OAuth settings, enable OAuth, select the scope **Manage user data via APIs (api)**, turn on **Enable JWT Bearer Flow**, and upload `germainux-salesforce.crt`.
>
> **3. Pre-authorize the integration user**
>
> In the app's policies, set **Permitted Users** to **Admin approved users are pre-authorized**, and add the integration user's permission set. JWT bearer login fails for users who aren't pre-authorized.
>
> **4. Copy the consumer key**
>
> Copy the app's **Consumer Key**. You need it in GermainUX.

### Run the Wizard

**1. Open the wizard**

In the left menu, go to **Settings > Wizards**. On the **Salesforce.com Application Monitoring** card, select **Add**.

**2. Select the Engine host**

In **Servers**, select the host that the GermainUX Engine runs on, and then select **Apply**. The wizard creates the components on that Engine.

**3. Fill in the fields**

Enter the values from the table below. To add a URL, a folder or credentials that don't exist yet, use the create option next to the field.

**4. Finish**

Select **Finish**. GermainUX creates the components, and they start at minute 30 of the next scheduled hour.

![Salesforce.com Application Monitoring wizard with the Salesforce URL, login URI, client ID, credentials and log folders filled in](https://mintcdn.com/germain-ux/TtuaB2s8HJ-ycgcJ/images/main/salesforce-engine-monitoring-deployment/wizard-salesforce-application.png?fit=max\&auto=format\&n=TtuaB2s8HJ-ycgcJ\&q=85\&s=2cbf07ef1ba9b7e1333e57b76d27bd09)

Salesforce.com Application Monitoring Wizard - GermainUX

| Field | What to enter |
| - | - |
| **Client ID** | The app's **Consumer Key**. |
| **Instance Name** | Your Salesforce instance, as shown in **Company Information** in Salesforce Setup (for example `USA580S`). |
| **User Credentials** | Credentials with the integration user's user name and password. Add the security token after the password unless you relaxed IP restrictions. For JWT bearer login, enter the user name here too; you add the private key later. |
| **URL** | Your org's My Domain URL, for example `https://acme.my.salesforce.com`. |
| **Log Directory** | A folder on the Engine host for the Event Monitoring log files. |
| **Login URI** | Where the Engine gets its access token: `https://login.salesforce.com` for production, `https://test.salesforce.com` for a sandbox, or your My Domain URL. |
| **Application** | The GermainUX application the data belongs to. Default: `Salesforce`. |
| **Client Secret** | The app's **Consumer Secret**. For JWT bearer login, which doesn't use it, enter any value. |
| **Debug Log Directory** | A folder on the Engine host for the downloaded debug logs. |
| **Refresh Token** | Leave empty. The components this wizard creates don't use it. |

### Use JWT Bearer Login

Do this only for the **JWT Bearer** login. It changes the five components that log in to Salesforce: Event Log Monitor, Audit Monitor, Stats Monitor, Code Monitor and Debug Log Monitor.

**1. Create credentials for the private key**

In the left menu, go to **Settings > Data Sources > Credentials**, and create credentials with the integration user's user name, and the content of `germainux-salesforce.key` as the password. The key can be on one line.

**2. Change the login request of each component type**

In the left menu, go to **Settings > System > Engine Settings > Component Types**. For each of the five component types, edit the login target `GetAccessToken` and replace its parameters with these two:

| Parameter | Value |
| - | - |
| `grant_type` | `urn:ietf:params:oauth:grant-type:jwt-bearer` |
| `assertion` | `${jwtAssertion}` |

**3. Switch each component to JWT**

In the left menu, go to **Settings > Germain > State**, and open the **Components** tab. For each of the five components, set **Auth Policy** to `JWT`, set **Credentials** to the credentials from step 1, and add two references:

| Reference | Value |
| - | - |
| `jwtIssuer` | The app's **Consumer Key** |
| `jwtAudience` | `https://login.salesforce.com`, or `https://test.salesforce.com` for a sandbox |

**4. Save**

Save each component. At every login, the Engine signs a new assertion that is valid for three minutes.

## Collection Schedule and API Usage

Each component runs at minute 30 of the hour, every whole number of hours. The intervals are under **Advanced** in the wizard. At the default intervals, the components make about these Salesforce API requests:

| Component | Default interval | API requests per run |
| - | - | - |
| Event Log Monitor | 1 hour | One query, plus one download per new event log file |
| Debug Log Monitor | 1 hour | One query, plus one download per new debug log |
| Stats Monitor | 1 hour | About 15 |
| Audit Monitor | 12 hours | 5, plus one per new deployment |
| Code Monitor | 24 hours | 4 |
| Instance Status Monitor | 12 hours | None. It calls Salesforce Trust, not your org. |

Each run of a component that logs in requests a new access token first. The Event Log Monitor and Debug Log Monitor look back 2 hours on each run, so a run that's skipped is caught up by the next one. The components use version 60.0 of the Salesforce REST API.

## Validate

**1. Check the components**

In the left menu, go to **Settings > Germain > State**, open the **Components** tab, and search for `Salesforce`. All ten components should be listed, enabled, on the Engine you selected.

**2. Wait for the first run**

The monitors run at minute 30 of the next scheduled hour. Salesforce publishes each hourly event log file about an hour after the hour ends, so allow two to three hours for the first Event Monitoring data.

**3. Open the Salesforce Logs dashboard**

In the left menu, go to **Dashboards > IT > Application > Salesforce > Salesforce Logs**. Logins, Lightning page views, API calls and Apex executions appear here first.

![Components tab of the State screen listing the ten Salesforce components and their status](https://mintcdn.com/germain-ux/TtuaB2s8HJ-ycgcJ/images/main/salesforce-engine-monitoring-deployment/state-components-salesforce.png?fit=max\&auto=format\&n=TtuaB2s8HJ-ycgcJ\&q=85\&s=5c8c51483bb0e5a85e9e50a6885f8f26)

Salesforce Components on the State Screen - GermainUX

![Salesforce Logs dashboard showing logins, Lightning page views, API calls, Apex executions and errors over five days](https://mintcdn.com/germain-ux/TtuaB2s8HJ-ycgcJ/images/main/salesforce-engine-monitoring-deployment/salesforce-logs-dashboard.png?fit=max\&auto=format\&n=TtuaB2s8HJ-ycgcJ\&q=85\&s=0339b1922c893ed904a4393b1ed77415)

Salesforce Logs Dashboard - GermainUX

### Example: A Release Slows Down Apex

In this example, a release changes the Opportunity pricing code in the morning. Open the [Analysis Dashboard](https://docs.germainux.com/dashboards/analytics-dashboard/4-analysis-dashboard.md) on **Salesforce Log Apex Execution** for that day. **VS RECENT** shows Apex executions take 2.2 seconds on average, against 0.48 seconds at the same hours on the previous days. The Relationships chart shows when: durations stay high from mid-morning, after the release, to mid-afternoon.

![Analysis of Salesforce Log Apex Execution on the release day, 2.21 seconds on average against 0.48 seconds on the previous days, with durations high from mid-morning to mid-afternoon](https://mintcdn.com/germain-ux/TtuaB2s8HJ-ycgcJ/images/main/salesforce-engine-monitoring-deployment/analysis-release-apex-execution.png?fit=max\&auto=format\&n=TtuaB2s8HJ-ycgcJ\&q=85\&s=c7a8b64d96ddca50deeb6f4de8e21101)

Apex Executions on the Day of a Release - GermainUX

To see what changed in a slow execution, compare it with a normal one.

### Example: Compare a Slow Save with a Normal One

Once Apex executions arrive, you can put a slow one next to a normal one and see what changed. In this example, a release changes the Opportunity pricing code, and Opportunity saves slow down on the same morning.

**1. Pick the slow save**

Open the drillthrough of **Salesforce Log Apex Execution** for the day of the release, sorted by duration. Open the actions of the slowest save and choose **Compare with another datapoint**.

**2. Pick a normal save**

Change the time range of the drillthrough to a normal day, and find a save of the same entry point. Open its actions and choose **Compare with the primary datapoint**.

**3. Read the differences**

The Compare page shows both saves side by side. Here, the save takes 14.6 seconds instead of 0.5, and the **Measures** card shows why: it runs 101 SOQL queries instead of 3. A query in a loop is the cause, not Salesforce or the network.

![Compare page of two Apex executions of the Opportunity pricing controller, 14.57 seconds on the release day against 0.53 seconds two days earlier, with 101 SOQL queries against 3 in the Measures card](https://mintcdn.com/germain-ux/TtuaB2s8HJ-ycgcJ/images/main/salesforce-engine-monitoring-deployment/compare-opportunity-save.png?fit=max\&auto=format\&n=TtuaB2s8HJ-ycgcJ\&q=85\&s=9237dc4a109424cf73faa685136b4b40)

Slow Opportunity Save Compared with a Normal One - GermainUX

Fix the code, then compare a save after the fix with the same normal one.

### Example: Salesforce Is Slow, Not Your Code

In this example, Salesforce reports a minor incident on your instance one afternoon. Open the analysis of **Salesforce Log Lightning Page View** for that afternoon. Pages take 2.4 seconds on average, against 1.7 seconds on the previous days. **Leading Factors** list many users and no single page, so no release or page of yours is the cause. To confirm, check **Salesforce Instance Status** for the same hours.

![Analysis of Salesforce Log Lightning Page View during a Salesforce minor incident, 2.37 seconds against 1.68 seconds on the previous days, with Leading Factors spread over many users](https://mintcdn.com/germain-ux/TtuaB2s8HJ-ycgcJ/images/main/salesforce-engine-monitoring-deployment/analysis-instance-incident-page-view.png?fit=max\&auto=format\&n=TtuaB2s8HJ-ycgcJ\&q=85\&s=5ac5216f67ec88f7a2e91cf294457fd6)

Lightning Page Views During a Salesforce Incident - GermainUX

### Example: An Integration Uses Up the API Limit

In this example, the ERP integration re-syncs Opportunities one morning. Open the analysis of **Salesforce Log Api** with the number of calls as the measure. The morning has 559 API calls, against 122 at the same hours on the previous days. **Leading Factors** point to the integration's address and its MuleSoft API calls. Check **Salesforce Resource Usage** to see how close the org came to its daily API limit.

![Analysis of Salesforce API calls during an integration re-sync, 559 calls against 122 on the previous days, with the integration address and MuleSoft API paths as Leading Factors](https://mintcdn.com/germain-ux/TtuaB2s8HJ-ycgcJ/images/main/salesforce-engine-monitoring-deployment/analysis-integration-resync-api.png?fit=max\&auto=format\&n=TtuaB2s8HJ-ycgcJ\&q=85\&s=a5bb30f1e1dbb9a95e0d15b643a03d03)

API Calls During an Integration Re-Sync - GermainUX

Spread the re-sync over a longer window, or move it to the night, so users keep enough API capacity.

## Troubleshooting

> [accordion] The wizard asks you to assign an engine
>
> The message "Please assign an engine to be responsible for monitoring the Salesforce Application before applying a profile to this host" means no GermainUX Engine runs on the host you selected in **Servers**. Select the host of an Engine that is installed and registered. See [GermainUX Engine](https://docs.germainux.com/deploy/germain-ux-engine.md).

> [accordion] The Engine log shows invalid\_grant
>
> Salesforce rejected the login. Check these, in order:
>
> * The user name, password and security token in the credentials. A password change also changes the security token.
> * The **Login URI**: `test.salesforce.com` for a sandbox, `login.salesforce.com` or your My Domain URL for production.
> * For username and password login: **Allow OAuth Username-Password Flows** is on, and the org isn't one that blocks the flow.
> * The integration user is pre-authorized for the app, and the app is the one whose consumer key you entered.
> * For JWT bearer login: the certificate in the app matches the private key, the user name in the credentials is the integration user, and the Engine's clock is correct.

> [accordion] No Event Monitoring data
>
> * The org has the Event Monitoring add-on, and the integration user has **View Event Log Files**.
> * Enough time has passed. Salesforce publishes hourly files with a delay, so data arrives two to three hours after the activity.
> * The **Log Directory** exists on the Engine host and the Engine can write to it, and the disk isn't full.

> [accordion] Gaps in Event Monitoring data
>
> The Event Log Monitor looks back 2 hours on each run. If you change the log monitoring interval, keep **Timespan of query** at least as long as the interval, or hours between runs are never collected.

> [accordion] No debug logs
>
> GermainUX collects only debug logs that exist in Salesforce. Set a trace flag for the users you want to trace, in Salesforce Setup under **Debug Logs**. Trace flags expire, and Salesforce deletes old logs and limits the space they use, so renew the trace flag while you need the logs.

> [accordion] No instance status
>
> Check the **Instance Name** against **Company Information** in Salesforce Setup, and that the Engine can reach `api.status.salesforce.com`.

> [accordion] User names are missing from Event Monitoring data
>
> GermainUX takes the user name from the Login event of the session. Activity from a session that started more than 24 hours earlier, or before the Event Log Monitor started, shows without a user name.

## Next Steps

> [card] [Configure Monitoring for Salesforce](https://docs.germainux.com/integrations/salesforce-monitoring/salesforce-monitoring-configuration.md)
>
> KPIs, SLAs, alerts and each monitored feature

> [card] [Salesforce KPIs](https://docs.germainux.com/integrations/salesforce-monitoring/salesforce-monitoring-kpis.md)
>
> What the components measure

## Get Help

> [card] [Contact GermainUX Support](https://docs.germainux.com/getting-started/support.md)
>
> The GermainUX team helps you get up and running faster, empower your team, turn data into actionable insights, and optimize performance to deliver measurable business outcomes.

> [card] Can't Find What You Need?
>
> Search all GermainUX docs with **Ctrl + K**, or use the feedback buttons at the bottom of this page to tell us what is missing.

The content of this document is proprietary to GERMAIN SOFTWARE.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.