Try it free

Salesforce Insights extension

  • Latest Dynatrace
  • Extension
  • 15-min read

Salesforce Insights enables Salesforce administrators and IT operation teams to monitor their Salesforce environment.

Get started

Learn how to set up Salesforce Insights and find out what kind of data it can capture.

Make sure to meet the following requirements to use the extension.

Salesforce account

The Salesforce extension can capture four types of Salesforce data. Select each configuration for more details.

  • The Event Streaming configuration allows you to monitor the usage of your Salesforce CRM account.

  • The EventLogFile configuration allows you to ingest log files from Salesforce into Dynatrace.

  • The API Queries configuration allows you to ingest Salesforce Object Query Language (SOQL) data into Dynatrace. The data is ingested into Dynatrace as log events or Business Events.

  • The Platform Events configuration allows you to subscribe to custom Salesforce Platform Events and ingest them as Business Events into Dynatrace.

Authentication

Choose one of the three authentication methods that best suits your needs.

Both OAuth methods use a Salesforce external client app. External client apps replace the legacy connected apps.

In this mode the extension uses the OAuth 2.0 Client Credentials Flow of an external client app.

Dynatrace will ask for

  • The Consumer Key of the external client app.
  • The Consumer Secret of the external client app.

Create the external client app

In Salesforce Lightning

  1. Under Setup > App Manager, select New External Client App.
  2. Enter a Name and set Distribution State to Local.
  3. Under API (Enable OAuth Settings), check Enable OAuth.
  4. If the Callback URL is not used, you can put in https://localhost.
  5. In Selected OAuth Scopes, add these scopes:
    • Manage user data via APIs (API)
    • Perform requests at any time (refresh_token, offline_access)
  6. Under the authentication flow settings, check Enable Client Credentials Flow.
  7. Leave all other settings as default and select Save.

Configure policies

  1. On the external client app page, under Policies, select Edit.
  2. Under App Policies > Profiles, add a profile that has the permissions listed in Approved users.
  3. Under OAuth Policies > Permitted Users, select Admin approved users are pre-authorized.
  4. Under OAuth Flows and External Client App Enhancements, enable Client Credentials Flow and set Run As to a username that belongs to the profile selected above.
  5. Select Save.

Approved users

Profiles need the following permissions for event streaming:

  • General user permissions
    • View Real-Time Event Monitoring Data
  • Administrative permissions
    • Customize Application
    • View All Data

To check the needed permissions documentation, see how to Enable Access to Real-Time Event Monitoring.

Get the client credentials

Under Setup > App Manager (External Client App Managers), select the external client app, then go to Settings > OAuth Settings to find the Consumer Key and Consumer Secret.

In this mode the extension connects as an external client app that implements the OAuth 2.0 JWT Bearer Flow.

Dynatrace will ask for

  • The Consumer Key of the external client app.
  • The Private Key (key.pem) matching the certificate uploaded to the external client app.
  • The Subject of the JWT token. This is the username of a user that is part of a Profile added to the external client app.

Requirements

  • openssl for generating the certificate. This is not needed if you already have a certificate and a private key.

    Note: on Windows, if you have git installed, you should also have a copy of openssl.
    You should find it in a directory such as C:\Program Files\Git\mingw64\bin depending on your installation.

Certificate

The external client app must have a certificate that Dynatrace later uses to authenticate with Salesforce through this certificate's private key.

This command generates a certificate and a private key:

openssl req -newkey rsa:2048 -nodes -keyout key.pem -x509 -days 365 -out cert.pem
  • The cert.pem file will be later added to the external client app.
  • The key.pem file will be used by Dynatrace to authenticate with Salesforce.

Create the external client app

Follow the same steps as in the Client Credentials Flow to create the external client app, with one difference: under the authentication flow settings, check Enable JWT Bearer Flow and upload the cert.pem file generated above instead of enabling the Client Credentials Flow.

Configure policies

  1. On the external client app page, under Policies, select Edit.
  2. Under App Policies > Profiles, add a profile that has the permissions listed in Approved users.
  3. Under OAuth Policies > Permitted Users, select Admin approved users are pre-authorized.
  4. Select Save.

Any username from a profile added to the external client app can be used as the Subject when configuring the extension.

Get the Consumer Key

Under Setup > App Manager (External Client App Managers), select the external client app, then go to Settings > OAuth Settings to find the Consumer Key.

  1. A regular Salesforce user with the permissions for the desired configuration (Event Streaming, Event Log File or SOQL).
  2. The password for the user.
  3. The security token for the user.

Note that this option is not recommended as user passwords and security tokens can change, it is usually used just to test the extension.

Activation and setup

To enable the Salesforce extension, you must have an Environment ActiveGate.

  1. Find the extension in Hub and activate it.
  2. Select Add monitoring configuration on the Configuration page.
  3. Select an ActiveGate group.
    • One of these servers will need to access the salesforce API, which is publicly available.
    • The login URLs are: https://login.salesforce.com or https://test.salesforce.com
    • The Pub/Sub endpoints are: api.pubsub.salesforce.com:7443 or api.deu.pubsub.salesforce.com:7443
    • A proxy can be configured later if necessary.
The parameters for the monitoring configuration
ParameterDescription

Endpoint name

Choose a helpful name to identify the endpoint

Login URL

Choose from Production or Sandbox

Pub/Sub URL

Choose from Global Endpoint or Europe (Frankfurt) Endpoint

Reporting Mode

Business Events, Logs, OpenKit (RUM)

Custom Application ID

The Dynatrace Custom Application ID for the app you created before(only needed if a managed environment is used and OpenKit is used as reporting mode.)

Authentication type

Choose from Client Credentials Flow, JWT Bearer Flow, or username and password. See Authentication.

Events filtering

Choose which real-time events you'd like to send to Dynatrace, by default all are enabled

Usernames Blocklist

Optional list of Usernames to ignore; use this to block automation/API users from reporting

Proxy

Optional proxy; in case the ActiveGate cannot connect to the Salesforce URLs

OpenKit

If you use OpenKit, we recommend starting with the Custom Application setup.

Details

Salesforce data ingest

Choose one of the four data ingest methods based on your monitoring needs.

Capture real-time events from Salesforce and send them as Business Events to Dynatrace.

RUM ingest should only be used on Managed Environments.

  1. Enable Real-time event Streaming.
  2. In Setup > Event Manager, enable Streaming Data for the events you want to capture.
  3. Obtain the credentials needed for the extension to connect to Salesforce.

Enable use cases such as:

  • Track Session Hijack, Credential Stuffing and Anomaly Events
  • Track important permission sets and changes
  • What are the slowest Lightning or Classic pages response times?
  • What files are being uploaded, downloaded, and by which user?
  • What are the most used reports, who is running them, what queries are being used?
  • What are the top API Queries being made?
  • What browsers are users using?
  • Where is Salesforce being accessed from?
  • How many users are using the platform currently, what is the user experience?

The extension uses the Salesforce Pub/Sub API to list for Event Streaming Events. These events are captured and sent as Business events, or in case of OpenKit as User Actions, with all their respective properties sent as Action Properties.

For a detailed description of every event and their properties, see the Salesforce documentation.

Currently captured events

EventsDescription

ApiAnomalyEvent

Track anomalies in how users make API calls.

ApiEventStream

Track user API queries in your organization.

BulkApiResultEvent

Track when a user downloads the results of a Bulk API request.

ConcurLongRunApexErrEvent

Track when a Concurrent Long Running Apex error has occurred.

CredentialStuffingEvent

Track when a user successfully logs in to Salesforce during an identified credential stuffing attack.

FileEvent

Track file activity. For example, track when a user downloads or previews a file.

LightningUriEventStream

Track when a user creates, accesses, updates, or deletes a record in Salesforce Lightning.

ListViewEventStream

Track when a user accesses data with list views.

LoginAsEventStream

Track when an admin logs into your organization as another user.

LoginEventStream

Track when a user logs in to your organization.

LogoutEventStream

Track when a user logs out in the Salesforce UI.

PermissionSetEvent

Track when users are assigned the Modify All Data or View All Data permission through a permission set.

ReportAnomalyEvent

Track anomalies in how users run or export reports.

ReportEventStream

Track when a user accesses or exports data with reports.

SessionHijackingEvent

Track when an unauthorized user gains ownership of a Salesforce user’s session with a stolen session identifier.

UriEventStream

Track when a user creates, accesses, updates, or deletes a record in Salesforce Classic.

The extension is limited to events that Salesforce produces as Real-Time Events.

Choose your reporting mode for Event Streaming data:

Business Events

For business events, all data is ingested using the business events API.

It can be queried using DQL:

fetch bizevents
| filter event.type == "salesforce.ApiEventStream"
Visualization of a query result
img.png
img.png

Each of the events of type salesforce.NameOfTheEvent will have all properties documented by Salesforce. For instance, see the properties for an ApiEventStream.

So we can create visualizations using all of these properties.

fetch bizevents
| filter event.type == "salesforce.ApiEventStream"
| summarize count(), by: {SourceIp}
Visualization of a query result
img.png
img.png

You can get a list of all event types with DQL:

fetch bizevents
| filter event.provider == "https://dynatrace--staging.sandbox.my.salesforce.com"
| summarize count(), by: {event.type}
Visualization of a query result
img.png
img.png

Example: Get logins by user overtime

fetch bizevents
| filter event.type == "salesforce.LoginEventStream"
| makeTimeseries logins=count(), by:{Username}, interval: 5m
| sort logins desc
Visualization of a query result
img.png
img.png

OpenKit

To create a custom application to receive the data:

  1. In Hub, see Digital Experience Monitoring section. Then, select Generic front end > Set up.
  2. Create your custom application—name it and choose an icon.
  3. Select Monitor custom application.
custom-app-01
custom-app-01
  1. In the Custom application settings, go to Instrumentation wizard and save the Application ID for later.
custom-app-02
custom-app-02
  1. Now you can enable the extension. For details, go back to the #enable-extension section.

The data is sent to the Frontend application that you created, so you can access:

  • Sessions Details
  • The individual properties, by selecting User Action > Perform waterfall analysis

To use these properties in User Sessions Query Language:

  1. In the application settings, go to Session and user action properties.
  2. Create a property. Note: the Name must match exactly the property name, see Salesforce events.

Example: Capture the rows number

salesforce-data-04
salesforce-data-04

Querying the property:

SELECT useraction.name, SUM(longProperties.rowsprocessed) FROM useraction WHERE useraction.name STARTSWITH "Report" GROUP BY useraction.name
salesforce-data-05
salesforce-data-05

EventLogFile

Capture event log files from Salesforce and ingest them as logs to Dynatrace.

  • EventLogFile needs to be enabled in Salesforce.
  • The user must have set permissions to read event log files.

Details

  1. Create a new EventLogFile configuration by selecting Configure EventLogFile.
    Note that under Events to capture all the different Log Files will be disabled by default.
  2. Select which log files you would like to ingest.

Do not expect real-time data out of this configuration. Event Log data is delayed by several hours in Salesforce.

Visualization

The events are sent as Log Events to Dynatrace, and can be queries using DQL:

fetch logs
| filter query.type == "EventLogFile"
Visualization of a query result
img.png
img.png

Every property for a certain Event Log File will be available.
To find fields details, see EventLogFile Supported Event Types.

Example

Get details about ApexExecution events:

fetch logs
| filter EVENT_TYPE == "ApexExecution"
| fields TIMESTAMP_DERIVED, ENTRY_POINT, EXEC_TIME, CPU_TIME, DB_TOTAL_TIME, NUMBER_SOQL_QUERIES
Visualization of a query result
img.png
img.png

API Queries (SOQL)

Run SOQL queries against Salesforce and ingest the data as logs or Business Events. The user must have permissions to query the Salesforce API, and read the Objects that are being queried.

Details

To ingest Salesforce Object Query Language (SOQL) data into Dynatrace,

  1. Select Configure API queries.

  2. Add up to 100 SOQL queries to be executed at the specified interval. Each query has the following parameters:

    • Query Name—A name for the query that will help you locate this query data later in Dynatrace Logs.
    • Query—The SOQL query to be executed.
      • The query must contain at least one datetime field.
      • The placeholder {last_execution_timestamp} must be used to filter the query results and deduplicate the data.
      • Example: SELECT Id, CreatedDate, Field, NewValue, OldValue FROM OpportunityFieldHistory WHERE CreatedDate > {last_execution_timestamp}
    • Frequency
      • The frequency can be of type Interval or Cron.
      • Interval—The query will be every X minutes.
      • Cron—The query will be executed based on the cron expression provided, you can use crontab guru to generate the cron expression.

Visualization

Let's consider this query configuration:

Query Name: Logins
Query: SELECT UserId, COUNT(Id) from LoginHistory WHERE LoginTime > {last_execution_timestamp} GROUP BY UserId
img.png
img.png

The results can be obtained with the DQL:

fetch logs
| filter query.name == "Logins"
Visualization of a query result
img.png
img.png

And a chart could be created with:

fetch logs
| filter query.name == "Logins"
| makeTimeseries sum(toDouble(expr0)), by: {UserId}, interval: 5m
Visualization of a query result
img.png
img.png

You can also fetch all the queries and their text configured for this Salesforce instance:

fetch logs
| filter event.provider == "https://dynatrace--staging.sandbox.my.salesforce.com"
| summarize count(), by: {query.name}
Visualization of a query result
img.png
img.png

Platform Events

Subscribe to custom Salesforce Platform Events and ingest them as Business Events to Dynatrace.

Platform Events provide a powerful way to send and receive custom event notifications within Salesforce and to external systems. This configuration allows you to capture real-time event data from custom platform events, standard platform events, and change data capture events.

Details

To ingest Salesforce Platform Events into Dynatrace:

  1. Select Configure Platform Events.

  2. Add the topics you want to subscribe to. Topics follow these formats:

    • Custom Platform Events: /event/YourCustomEvent__e
    • Standard Platform Events: /event/LoginEventStream, /event/LogoutEventStream
    • Change Data Capture: /data/ChangeEvents, /data/AccountChangeEvent
  3. Configure authentication using one of the supported methods (Client Credentials Flow, JWT Bearer Flow, or User and Password).

Use Cases

Enable use cases such as:

  • Monitor custom business processes and workflows
  • Track changes to critical Salesforce objects with Change Data Capture
  • Integrate with external systems using custom Platform Events
  • Build real-time dashboards and alerts based on Salesforce events
  • Correlate Salesforce events with other observability data

Visualization

Platform Events are sent as Business Events to Dynatrace and can be queried using DQL:

fetch bizevents
| filter event.type == "salesforce.YourCustomEvent__e"
Example: Query all Platform Events from a Salesforce instance
fetch bizevents
| filter event.provider == "https://yourinstance.my.salesforce.com"
| summarize count(), by: {event.type}

Each Platform Event will include all custom fields defined on the event, making them available for filtering, grouping, and visualization.

Extend the retention period for Salesforce Insights data

By default, your ingested data is stored for 30 days. You can adjust the retention time by creating a custom bucket.

To create a custom bucket for a Salesforce event

  1. In Dynatrace, go to Settings Settings > Business Observability > Bucket assignment.

  2. On the Business event bucket assignment page, select Add rule and name your rule.

  3. In the Bucket field, choose your retention period.

  4. Add a Matcher to your rule by typing or pasting your matcher-specific DQL query. Events that match your rule will be assigned to your selected bucket. If no rules match, events will be assigned to the default bucket. To assign all your Salesforce events to your bucket, you need to use the matcher containing the matchesValue function and your Salesforce URL, as in the example below.

    matchesValue(event.provider, "https://environment.my.salesforce.com")
  5. Select Save changes.

FAQ

How do I access error logs?

In Dynatrace, go to the extension page and select Status for each monitoring configuration.

How do I get detailed logs?

Detailed logs can be obtained by using ActiveGate diagnostics.

Hub

Explore in Dynatrace Hub

Monitor your Salesforce CRM environment by ingesting real-time events, event log files, SOQL query results, and Platform Events as business events and logs into Dynatrace.

Related tags
ComputePythonSAAS PlatformSalesforceBusiness Observability