Edit

Share via


sys.fn_MSxe_read_event_stream (Transact-SQL)

Applies to: SQL Server Azure SQL Database Azure SQL Managed Instance

sys.fn_MSxe_read_event_stream returns binary data for internal use by the QueryableXEventData .NET class. Extended Events UI in the SQL Server Management Studio (SSMS) uses this class to read event session data.

To view human-readable event data, use one of the following instead of calling sys.fn_MSxe_read_event_stream directly:

Transact-SQL syntax conventions

Syntax

sys.fn_MSxe_read_event_stream ( source , source_option )

Arguments

source

The specific source of event data returned by the function. Source is nvarchar(260) with no default.

Source is interpreted differently depending on the value of source_option:

source_option Interpretation of source
0 Source is the name of a started event session.
1 Source is the path to the event session log files to read.

When used with files in the local file system, source must include the name of an event session log file and can contain * as a wildcard.

When used with blobs in an Azure Storage container, source is an HTTP URL constructed by the concatenation of two parts:

1. The path to an Azure Storage storage container, followed by a slash (/).
2. A common prefix for the names of blobs in the container that should be read.

For example, using https://<storage-account-name>.blob.core.windows.net/container-name>/xe_session as source retrieves data from all blobs with names starting with xe_session, and regardless of the remainder of the blob name including the extension. Wildcards can't be specified. A credential allowing access to the Azure Storage container must exist.

source_option

The option that determines the type of the event data source. Possible values are:

Value Description
0 Returns event data from the event_stream target of a started event session. The function executes indefinitely, returning new event data as the session produces it.
1 Returns event data from the extended event log files specified by source.

Table returned

Column name Data type Description
type int The event type. Not nullable.
data image Binary event data. Is nullable.