I have Azure SQL Audit enabled on one of my databases. I would like to be able to automate a process whereby the contents of the file(s) for a given day are stored in a SQL table. However, to do that, I need to know the names of the blob files to process for a given day. For example in my blob folder I see the following:
In order for me to automate this process, I need to know the files that are there, and what they are named. How would I go about doing this? I will probably be using T-SQL to process these files.
Blob filename format: CreationTime_FileNumberInSession.xel
As you can see, the file names are random as they are based on the time of day when they were created.
Audit blob files are stored in the following directories hierarchy within the "sqldbauditlogs" container (‘/’ delimiter signifies directory hierarchy):
<ServerName>/<DatabaseName>/<AuditName>/<CreationDate>/
To process all logs for a given day, simply collect all blobs in the relevant ../<CreationDate>/ hierarchy.
Thanks,
Gilad (MSFT)