简体   繁体   中英

How to read SQL server logs (XEL) files in Java

I am trying to process the SQL server log file (XEL) in Java and convert into other format like JSON. I am not able to find any documentation on How to read XEL files and there are no library that can be used to read the XEL file.

Any pointers will be helpful. Thanks in advance

Indeed, I tried to search for a library to parse XEL format file in Java, but failed. I think a workaround solution to satisfy your needs may should be considered by you.

Here is some workaround solutions in my mind.

  1. There are some tools to help parsing XEL format file, such as Log Parser 2.2 and Read-DbaXEFile function of PowerShell Module sqlcollaborative/dbatools . For Log Parser 2.2 usage, please refer to the blogs How to parse SQL Server Error Log with Log Parser 2.2 and Microsoft's Log Parser Utility: Swell ETL . For function Read-DbaXEFile , please see its source code https://github.com/sqlcollaborative/dbatools/blob/master/functions/Read-DbaXEFile.ps1 .

  2. There is a nuget package named XELite in C#, which be cross platform library to read XEvents from XEL files or live SQL streams.

Considering for your scenario, I think you can try to the two workaround solution to parse XEL format files stored in Azure Storage first within Azure Functions in C# or PowerShell with Blob Trigger , or within Azure Data Factory with a Custom activity , to extract these data what you want for further data processing in Spark.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM