This guide outlines a structured approach to analyzing Salesforce logs to identify and investigate potential data exfiltration. It is designed for security professionals with general security knowledge but limited familiarity with Salesforce-specific logging, and it focuses on log sources, key event types and fields, and correlating activity across logs.
This guide is one suggested approach. As you become more familiar with the logs and techniques available, you can tailor these steps to the particulars of your Salesforce environment. Real-Time Event Monitoring (RTEM) and Event Log Objects (ELO) require the Salesforce Shield add-on.
This article explains how to investigate potential data exfiltration in Salesforce by analyzing Setup Audit Trail, Event Log Files (ELF), and Real-Time Event Monitoring (RTEM) logs, and how to correlate login, API, Bulk API, and SOQL activity across them.
Salesforce provides several log sources which can be useful for security investigations:
While Event Monitoring logs are only available to customers who have purchased and enabled the Salesforce Shield add-on, the primary distinction between ELF and RTEM/ELO lies in their latency and data granularity. RTEM/ELO offers immediate access to a richer dataset, making it ideal for proactive security monitoring and rapid incident response. ELF, on the other hand, is best suited for post-incident investigation and compliance.
When investigating data exfiltration, it is helpful to focus on event types that record user interactions, logins, and API calls. The following sections list the key event types and their critical fields.
These events track when and how users access your Salesforce environment, which can be an important factor for identifying unauthorized access.
Login Event Type (ELF) tracks user login activity.
LoginEvent (RTEM/ELO) tracks user login activity.
These events provide details about requests made via Salesforce APIs, including standard SOAP, REST, and Apex calls.
ApiEvent (RTEM/ELO)
API Total Usage Event Type (ELF)
REST API Event Type (ELF)
SOAP API (ELF)
These events are particularly relevant when investigating large-scale data extraction, often associated with tools like Salesforce Data Loader.
Bulk API Event Type (ELF)
Bulk API 2.0 Event Type (ELF)
BulkApiResultEvent (RTEM/ELO) tracks when a user downloads the results of a Bulk API request.
Unique Query Event Type (ELF) captures specific search queries (SOQL), filter IDs, and report IDs that are processed, along with the underlying database queries (SQL).
This section provides a systematic approach to investigating potential data exfiltration, focusing on correlating data across log types.
Before diving into extensive log analysis, understanding the potential scope of impact can help to focus and prioritize the analysis.
Determine User Access and Permissions: Given the complex interplay of Profiles, Permission Sets/Groups, Sharing Rules, and Role Hierarchies, assessing a user's permissions can be challenging. Tools like Security Center or the Authenticated and Guest User Access Report and Monitoring Tool available on AppExchange offer a rapid and comprehensive overview of which objects and fields a user has permission to access, alter, and export, often highlighting sensitive fields.
Assess Privilege Levels: If the initial assessment reveals that a user had broad access to sensitive data and could make significant changes, a more in-depth analysis of specific accessed and altered data may be necessary. Conversely, adherence to the principle of least privilege helps limit the impact of any security incident.
The investigation begins by identifying any unusual login patterns that might indicate a compromised account.
Objective: Detect logins from unexpected locations, times, or associated with unfamiliar applications.
Data Sources: Login Event Type (ELF) or LoginEvent (RTEM/ELO).
Analysis Steps:
Correlation Tip: Extract the LOGIN_KEY (or LoginKey) and SESSION_KEY (or SessionKey) from any suspicious login events. These unique identifiers are crucial for correlating subsequent activities back to this specific login session.
Example 1: Anomalous Login Location. Imagine your organization's security team identifies a user whose primary location is the U.S., but the Login Event Type (ELF) logs show multiple successful logins for this USER_ID (for example, 005FL000004coZNQAY) from "DE" (Germany) on a particular date (for example, 2025-06-11). This geographic anomaly, especially if it is inconsistent with the user's travel history or typical access patterns, warrants immediate investigation. Note the LOGIN_KEY and SESSION_KEY associated with these German logins for cross-referencing with other event types.
After identifying suspicious logins, the next step is to investigate what actions were performed through API calls during those sessions. API activity is a common vector for data exfiltration.
Objective: Identify specific data queries, the objects involved, and the volume of data retrieved via API.
Data Sources: API Total Usage Event Type (ELF), ApiEvent (RTEM/ELO), REST API Event Type (ELF).
Analysis Steps:
Correlation Tip: The REQUEST_ID (ELF) or RequestIdentifier (RTEM/ELO) can link multiple API events that are part of a single transaction, helping to reconstruct a complete sequence of API calls.
Example 2: API Query and Data Exfiltration. Following the anomalous login from Example 1, further investigation using the identified LoginKey in ApiEvent (RTEM/ELO) logs might reveal an ApiEvent with a ConnectedAppId linked to a third-party application. The Operation could be "QueryAll," and the Query field might display "Select AccountNumber, Active__c FROM Account". The RowsProcessed field indicates that 16 records were returned. This directly confirms that specific account data was queried and likely exfiltrated. The detailed information in ApiEventStream (RTEM) even shows the IDs of the 16 downloaded records.
Bulk API is often used by data loading tools for efficient handling of large data volumes. Investigating these events is crucial for identifying mass data exfiltration.
Objective: Pinpoint large-scale data extractions, identifying the specific objects and volumes.
Data Sources: Bulk API Event Type (ELF), Bulk API 2.0 Event Type (ELF), and BulkApiResultEvent (RTEM/ELO).
Analysis Steps:
Correlation Tip: Use the LOGIN_KEY (or LoginKey) and SESSION_KEY (or SessionKey) to connect Bulk API operations to the overall user session, and REQUEST_ID to track individual bulk transactions.
Example 3: Large-Scale Data Extraction via Bulk API. A security team investigates a user who recently resigned. By querying Bulk API 2.0 Event Type (ELF) logs, they discover several "query" operations for ENTITY_TYPE "Contact" and "Account." These activities originate from an unfamiliar CLIENT_IP and occurred during off-hours, aligning with the departing user's USER_ID. The RECORDS_PROCESSED field for these events shows an extraction of over 2000 records in a single operation. This combination of unusual IP, off-hours access, and high volume indicates potential unauthorized large-scale data exfiltration.
Data in Salesforce is often interrogated using Salesforce Object Query Language (SOQL). Understanding the information in a given SOQL query is critical to determining what data was targeted and how.
Data Sources: Unique Query Event Type (ELF), ApiEvent (RTEM/ELO), BulkApiResultEvent (RTEM/ELO).
Analysis Steps:
Systematic analysis of Salesforce logs, coupled with correlation across different event types using common identifiers like login keys and request IDs, can form an important part of effectively investigating security incidents and determining the scope of any data exfiltration. By examining anomalous login patterns, reviewing API queries, and scrutinizing bulk data operations, organizations can reconstruct event timelines and understand the full impact.
Next Step Suggestion: To enhance your organization's defensive capabilities, establish a routine monitoring strategy for these critical event types. By understanding normal baseline activities in your environment, you can more easily identify deviations, enabling early detection and problem prevention rather than solely reacting to incidents.
Salesforce Object Query Language (SOQL) is Salesforce's proprietary query language, similar to SQL, used to search your organization's Salesforce data for specific information. It allows you to select specific fields from Salesforce objects and filter records based on various conditions.
Imagine your Salesforce data is like a massive library with many different filing cabinets. You might have a cabinet for Accounts (companies you work with), another for Contacts (people at those companies), and one for Opportunities (your potential deals). SOQL is a very structured way of writing a request slip to the librarian (Salesforce) to find specific information for you.
This is the first part of your request. Here, you tell the librarian exactly which pieces of information you want from each file.
Example: SELECT Name, Industry
Simple English: "When you find the files I want, please write down only the Name and the Industry from each one."
Example: FROM Account
Simple English: "Look for these files only in the Account filing cabinet."
Example: WHERE Industry = 'Technology'
Simple English: "Please only pull files that have a label that says 'Industry' with the word 'Technology' on it."
Example: ORDER BY Name ASC
Simple English: "After you find everything, please sort the results alphabetically by the company's Name."
Example: LIMIT 10
Simple English: "Even if you find hundreds of matching files, please stop after the first 10 and just bring me those."
Example: SELECT Name, Industry FROM Account WHERE Industry = 'Technology' ORDER BY Name ASC LIMIT 10
Simple English: "Please go to the Account cabinet (FROM). Look for all the files where the Industry is 'Technology' (WHERE). From those files, write down just the Name and Industry (SELECT). Finally, sort that list alphabetically by Name (ORDER BY) and only give me the first 10 you find (LIMIT)."
005229030

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.