LogoutEvent

Tracks user UI logouts. A logout event records a successful user logout from your org’s UI. LogoutEvent is a big object that stores the event data of LogoutEventStream. This object is available in API version 46.0 and later.

Use LogoutEvent data to implement custom logic during logout. For example, you can revoke all refresh tokens for a user at logout.

LogoutEvent records logouts, not timeouts. Timeouts don’t cause a LogoutEventStream object to be published. An exception is when a user is automatically logged out of the org after their session times out because the org has the Force logout on session timeout setting enabled. In this case, a logout event is recorded. However, if users close their browser during a session, regardless of whether the Force logout on session timeout setting is enabled, a logout event isn’t recorded.

describeSObjects(), query()

Accessing this object requires either the Salesforce Shield or Salesforce Event Monitoring add-on subscription and the View Real-Time Event Monitoring Data user permission.

See Also

Type: dateTime

Properties: Filter, Sort

Description: The time when the specified logout event was captured. For example, 2020-01-20T19:12:26.965Z. Milliseconds are the most granular setting.

Type: string

Properties: Filter, Sort

Description: The unique ID of the event. For example, 0a4779b0-0da1-4619-a373-0a36991dff90.

Type: string

Properties: Nillable

Description: The string that ties together all events in a given user’s login session. It starts with a login event and ends with either a logout event or the user session expiring.

Type: reference

Properties: Nillable

Description: This is a relationship field.

Relationship Name: Profile

Refers To: Profile

Type: reference

Properties: Nillable

Description: This is a relationship field.

Relationship Name: Role

Refers To: UserRole

Type: string

Properties: Nillable

Description: The user’s unique session ID. You can use this value to identify all user events within a session. When a user logs out and logs in again, a new session is started.

Type: picklist

Properties: Nillable, Restricted picklist

Description: Indicates the session-level security of the session that the user is logging out of for this event. Session-level security controls user access to features that support it, such as connected apps and reporting. Possible values are:

  • HIGH_ASSURANCE—A high assurance session was used for resource access. For example, when the user tries to access a resource such as a connected app, report, or dashboard that requires a high-assurance session level.
  • LOW—The user’s security level for the current session meets the lowest requirements.
  • STANDARD—The user’s security level for the current session meets the Standard requirements set in the org’s Session Security Levels.

This low level is not available, nor used, in the Salesforce UI. User sessions through the UI are either standard or high assurance. You can set this level using the API, but users assigned this level will experience unpredictable and reduced functionality in their Salesforce org.

Type: string

Properties: Nillable

Description: The source IP address of the client logging out. For example, 126.7.4.2.

Type: reference

Properties: Nillable

Description: Represents the ID of the user associated with the logout event.

Type: string

Properties: Nillable

Description: Represents the username of the user associated with the logout event.

Currently, the only supported SOQL function on LogoutEvent is WHERE, and you can only use comparison operators (=, <, >, <=, and >=) on the final expression in a WHERE clause. The != operator isn’t supported.

Date functions such as convertTimezone() aren’t supported. For example, SELECT CALENDAR_YEAR(EventDate), Count(EventIdentifier) FROM LogoutEvent GROUP BY CALENDAR_YEAR(EventDate) returns an error. You can use date literals in your queries and some date and date/time functions like TODAY, YESTERDAY, and LAST_n_DAYS:1. However, these functions use comparison operators behind the scenes. This means you can only use them in the final expression of a WHERE clause.

LogoutEvent allows filtering over two ordered fields: EventDate and EventIdentifier. There’s a catch here; your query won’t work unless you use the correct order and combination of these fields. The following list provides some examples of valid and invalid queries:

  • Unfiltered

    • Valid—Contains no WHERE clause, so no special rules apply.

  • Filtered on EventDate

    • Valid—You can filter solely on EventDate, but single filters on other fields fail. You can also use a comparison operator in this query type.

    • Valid—You can filter on EventDate using date literals.

  • Filtered on EventDate and EventIdentifier

    • Valid—Successful queries on LogoutEvent filter over both fields.

    • Invalid—Queries on LogoutEvent with EventDate and standard date literals.

    • Invalid—Filtering only on EventDate with <= or >= operator and EventIdentifier field isn’t supported.