HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlMinor

Getting ApplicationName (sqlserver.client_app_name) to show up in an xevent

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
showsqlserverclient_app_namegettingxeventapplicationname

Problem

I am trying to examine some T-SQL with extended events like I used to with SQL profiler. I have the following event session:

IF EXISTS (SELECT name FROM sys.dm_xe_sessions WHERE Name = 'PySoup tracing')
BEGIN
    DROP EVENT SESSION [PySoup tracing] ON SERVER
END

CREATE EVENT SESSION [PySoup tracing] ON SERVER 
ADD EVENT sqlserver.rpc_completed (ACTION(sqlserver.client_app_name, sqlserver.sql_text )),
ADD EVENT sqlserver.sp_statement_completed (ACTION(sqlserver.client_app_name, sqlserver.sql_text )),
ADD EVENT sqlserver.sql_batch_completed (ACTION(sqlserver.client_app_name, sqlserver.sql_text )),
ADD EVENT sqlserver.sql_statement_completed (ACTION(sqlserver.client_app_name, sqlserver.sql_text ))
ADD TARGET package0.event_file(SET filename=N'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\Log\PySoup tracing.xel')--,
--ADD TARGET package0.ring_buffer(SET max_events_limit=(1000000))
GO

ALTER EVENT SESSION [PySoup tracing] ON SERVER
    STATE = START;


I thought that the ACTION clause was supposed to list the columns that were returned by the event. However, I don't see sqlserver.client_app_name column when I view the event data in the GUI.

What am I doing wrong?

Solution

I have seen this issue before, what seems to happen if you have this type of sequence:

  • create session



  • start session



  • stop session



  • add columnar data (action or field)



  • start session



The GUI doesn't show the added columnar data. Your options here would be to directly query the target or to clear/rename the old session definition's XEL files.

Context

StackExchange Database Administrators Q#88794, answer score: 8

Revisions (0)

No revisions yet.