A command line tool to fixup corrupted tags in Azure Communication Services usage logs
Use at your own risk!
ACSUsageLogFixup.exe <month> <day> <mode>
, where:
-
<month>
and<day>
are used to construct the/m=<month>/d=<day>/
part of the log path. Run the tool multiple times, once for each day to be processed. -
mode
is either "safe" or "update"-
"safe" means source container ("insights-logs-usage") remains untouched:
-
Copy each log file to a separate "insights-logs-usage-backup" container.
-
Verify that we are able to update broken "tags" and that after the update, the value is avalid JSON.
-
-
"update" makes changes in the source container:
-
Copy each log file to a separate "insights-logs-usage-backup" container. It will overwrite the backup created by the "safe" mode.
-
Perform substituion of broken "tags" into an empty element:
"tags":""
-
Write updated log into a 2nd blob next to the original one, called
<originalname>_updated.json
-
Delete the
<originalname>.json
-
-
To run:
-
Set environment variable
AZURE_STORAGE_CONNECTION_STRING
. -
In src\ACSUsageLogFixup run:
dotnet restore
-
Run in "safe" mode, in src\ACSUsageLogFixup:
dotnet run 11 29 safe
-
Verify that backups got created and that tool reports substitions and no errors.
-
Run in "update" mode, in src\ACSUsageLogFixup:
dotnet run 11 29 update
-
Verify that updated JSONs look good in the original container for that day.
-
Repeat for other months/days that need fixing.