How to query .xel log files in Azure SQL DB using T-sql by info.odysseyx@gmail.com October 11, 2024 written by info.odysseyx@gmail.com October 11, 2024 0 comment 11 views 11 problem A recent issue was brought to our attention where customers were unable to query .xel log files in Azure SQL DB using t-sql commands. The customer complained that while they received the column headers when running the command and there was no content, they knew the log had content because they were able to open the log with SSMS using Extended Event File Merge. The T-sql command used by our customer is: select * from sys.fn_get_audit_file(‘https://mydbastorage.blob.core.windows.net/sqldbauditlogs/servername/dbname/SqlDbAuditing_Audit_NoRe…‘, NULL, NULL);select * from sys.fn_get_audit_file(‘https://mydbastorage.blob.core.windows.net/sqldbauditlogs/servername/dbname/SqlDbAuditing_Audit_NoRe…‘, NULL, NULL); error No error is generated, but the customer only receives column headers and no data. authority According to the official document, control database Permission is required to query .xel log files. How to solve In this case, the customer control database As mentioned above, I have permission to log in to the SQL server, but I cannot query the .xel file using t-sql as mentioned above. Finally we encouraged him to make some changes to his t-sql query and after that he was able to successfully query the .xel log files. The asterisk wildcard ‘*’ does not work in Azure SQL DB, so using ‘*’ in T-sql commands for auditing will not work.. Below are the updated T-sql commands we recommend for customers to query their database. select * from sys.fn_get_audit_file(‘https://mydbastorage.blob.core.windows.net/sqldbauditlogs/servername/dbname/SqlDbAuditing_Audit_NoRe…‘, NULL, NULL); References https://learn.microsoft.com/en-us/sql/relational-databases/system-functions/sys-fn-get-audit-file-tr… https://learn.microsoft.com/en-us/sql/relational-databases/system-functions/sys-fn-get-audit-file-v2… Source link Share 0 FacebookTwitterPinterestEmail info.odysseyx@gmail.com previous post Building Web Apps – A 6-Lesson Course on Linkedin Learning next post Alcatraz AI Biometrics: Next-Level Workplace Security You may also like Believe Hyp about Quantum Protection: Report March 11, 2025 Google Jemi is coming to Android Auto but the rollout is hassle March 10, 2025 How the drones are transmitting security on the US southern border March 7, 2025 Remember a uninterrupted tech trailballs: Tom Mitchell March 7, 2025 New HMD X 1 ‘Safe’ Phone: Protection for Parents, Great Factors for Kids March 5, 2025 Opera adds Agent AI to his browser March 4, 2025 Leave a Comment Cancel Reply Save my name, email, and website in this browser for the next time I comment.