Description
I was thinking it would be nice to capture errors and warnings using an extended event like you do with the slow queries. Typically if someone tells me their app is timing out or something I will setup a session on the "Error Reported" event and filter out the every day warnings (5701, 5703, 8153, etc.). This would allow us gather things like malformed queries being executed, timeouts on connection, etc. and use that to work with the development teams. I think there would have to be something in the configuration side that we would use to filter out the error numbers we don't care about so that it's not taking up more storage than necessary.
CREATE EVENT SESSION [DBADash_Errors] ON SERVER
ADD EVENT sqlserver.error_reported( ACTION(package0.last_error,sqlserver.client_app_name,sqlserver.client_hostname,sqlserver.database_name,sqlserver.is_system,sqlserver.query_hash,sqlserver.query_plan_hash,sqlserver.session_id,sqlserver.sql_text,sqlserver.username)
WHERE ([error_number]<>(5701) AND [error_number]<>(5703) AND [error_number]<>(8153)))
ADD TARGET package0.ring_buffer
WITH (MAX_MEMORY=4096 KB,EVENT_RETENTION_MODE=ALLOW_MULTIPLE_EVENT_LOSS,MAX_DISPATCH_LATENCY=2 SECONDS,MAX_EVENT_SIZE=0 KB,MEMORY_PARTITION_MODE=NONE,TRACK_CAUSALITY=OFF,STARTUP_STATE=OFF)
GO