Extended Event with app_name doesn’t work properly
Hello,
When I create an extended event to capture all the SELECT on the instance, it works :
CREATE EVENT SESSION [YourSession] ON SERVER
ADD EVENT sqlserver.sql_statement_completed(
ACTION(sqlserver.client_hostname,sqlserver.database_name,sqlserver.nt_username,sqlserver.session_id,sqlserver.session_nt_username,sqlserver.sql_text,sqlserver.username)
WHERE ([sqlserver].[like_i_sql_unicode_string]([sqlserver].[sql_text],N’%SELECT%’)))
ADD TARGET package0.event_file(SET filename=N’S:Program FilesMicrosoft SQL ServerMSSQL16.FORMATIONMSSQLMSSQLBackupYourSession_Target.xel’,max_file_size=(2),max_rollover_files=(2))
WITH (MAX_MEMORY=2048 KB,EVENT_RETENTION_MODE=ALLOW_MULTIPLE_EVENT_LOSS,MAX_DISPATCH_LATENCY=3 SECONDS,MAX_EVENT_SIZE=0 KB,MEMORY_PARTITION_MODE=NONE,TRACK_CAUSALITY=OFF,STARTUP_STATE=OFF)
GO
But, when I use the app_name ACTION, it doesn’t work anymore :
CREATE EVENT SESSION [YourSession] ON SERVER
ADD EVENT sqlserver.sql_statement_completed(
ACTION(SQLSatellite.AppName,sqlserver.client_hostname,sqlserver.database_name,sqlserver.nt_username,sqlserver.session_id,sqlserver.session_nt_username,sqlserver.sql_text,sqlserver.username)
WHERE ([sqlserver].[like_i_sql_unicode_string]([sqlserver].[sql_text],N’%SELECT%’)))
ADD TARGET package0.event_file(SET filename=N’S:Program FilesMicrosoft SQL ServerMSSQL16.FORMATIONMSSQLMSSQLBackupYourSession_Target.xel’,max_file_size=(2),max_rollover_files=(2))
WITH (MAX_MEMORY=2048 KB,EVENT_RETENTION_MODE=ALLOW_MULTIPLE_EVENT_LOSS,MAX_DISPATCH_LATENCY=3 SECONDS,MAX_EVENT_SIZE=0 KB,MEMORY_PARTITION_MODE=NONE,TRACK_CAUSALITY=OFF,STARTUP_STATE=OFF)
GO
Do you have any clue about why the extended event doesn’t capture the SELECT when the action AppName is selected ?
Regards,
Alktor
Hello, When I create an extended event to capture all the SELECT on the instance, it works :CREATE EVENT SESSION [YourSession] ON SERVERADD EVENT sqlserver.sql_statement_completed(ACTION(sqlserver.client_hostname,sqlserver.database_name,sqlserver.nt_username,sqlserver.session_id,sqlserver.session_nt_username,sqlserver.sql_text,sqlserver.username)WHERE ([sqlserver].[like_i_sql_unicode_string]([sqlserver].[sql_text],N’%SELECT%’)))ADD TARGET package0.event_file(SET filename=N’S:Program FilesMicrosoft SQL ServerMSSQL16.FORMATIONMSSQLMSSQLBackupYourSession_Target.xel’,max_file_size=(2),max_rollover_files=(2))WITH (MAX_MEMORY=2048 KB,EVENT_RETENTION_MODE=ALLOW_MULTIPLE_EVENT_LOSS,MAX_DISPATCH_LATENCY=3 SECONDS,MAX_EVENT_SIZE=0 KB,MEMORY_PARTITION_MODE=NONE,TRACK_CAUSALITY=OFF,STARTUP_STATE=OFF)GO But, when I use the app_name ACTION, it doesn’t work anymore :CREATE EVENT SESSION [YourSession] ON SERVERADD EVENT sqlserver.sql_statement_completed(ACTION(SQLSatellite.AppName,sqlserver.client_hostname,sqlserver.database_name,sqlserver.nt_username,sqlserver.session_id,sqlserver.session_nt_username,sqlserver.sql_text,sqlserver.username)WHERE ([sqlserver].[like_i_sql_unicode_string]([sqlserver].[sql_text],N’%SELECT%’)))ADD TARGET package0.event_file(SET filename=N’S:Program FilesMicrosoft SQL ServerMSSQL16.FORMATIONMSSQLMSSQLBackupYourSession_Target.xel’,max_file_size=(2),max_rollover_files=(2))WITH (MAX_MEMORY=2048 KB,EVENT_RETENTION_MODE=ALLOW_MULTIPLE_EVENT_LOSS,MAX_DISPATCH_LATENCY=3 SECONDS,MAX_EVENT_SIZE=0 KB,MEMORY_PARTITION_MODE=NONE,TRACK_CAUSALITY=OFF,STARTUP_STATE=OFF)GO Do you have any clue about why the extended event doesn’t capture the SELECT when the action AppName is selected ? Regards,Alktor Read More