Version 0.4.2
February 2025
This guide describes how to get information about offloads and onloads that have been processed by ShArc. It's a temporary feature that allows to gather some information about the processed files, but it will be replaced with the history feature later.
Use this enhanced query to get statistics for job runs.
AppServiceConsoleLogs
| where ResultDescription has "'Restore' started with"
or ResultDescription has "'Offload' started with"
or ResultDescription has "'Policy Offload' started with"
or ResultDescription has "'Job' finished"
or ResultDescription has "(JobId: "
or ResultDescription has "Skipped file"
| extend JobId = extract(@"\(JobId: ([0-9a-fA-F-]+)\)", 1, ResultDescription)
| where isnotempty(JobId)
| extend EventType =
case(
ResultDescription has "' started with", "Start",
ResultDescription has "Job finished", "End",
ResultDescription has "finished successfully for file", "Success",
ResultDescription has "Job finished with error", "OnloadError",
ResultDescription has "Skipped file", "SkippedFile",
"Other"
)
| extend JobType = case(
ResultDescription has "Restore", "Restore",
ResultDescription has "Policy Offload", "PolicyOffload",
ResultDescription has "Offload", "Offload",
"Unknown"
)
| summarize
StartTime = argmin(TimeGenerated, TimeGenerated),
EndTime = argmax(TimeGenerated, TimeGenerated),
AllJobTypes = makeset(JobType),
SuccessCount = countif(EventType == "Success"),
OnloadErrorCount = countif(EventType == "OnloadError"),
SkippedItemCount = countif(EventType == "SkippedFile")
by JobId
| extend JobType = case(
sethaselement(AllJobTypes, "Restore"), "Restore",
sethaselement(AllJobTypes, "PolicyOffload"), "PolicyOffload",
sethaselement(AllJobTypes, "Offload"), "Offload",
"UserRestore"
)
| extend Duration = EndTime - StartTime
| project JobId, StartTime, EndTime, Duration, JobType, SuccessCount, OnloadErrorCount, SkippedItemCount
| order by StartTime desc
Please note, that the first line requires to specify the JobId. This id is provided in the Job Statistics query results and can be copied from there.
let jobIdToCheck = "af6a32de-0a93-49a0-80c9-71c022d3bd9b"; // Replace with the actual JobId
AppServiceConsoleLogs
| where ResultDescription has strcat("(JobId: ", jobIdToCheck, ")")
| extend EventType =
case(
ResultDescription has "Offload finished successfully" or ResultDescription has "Onload finished successfully", "Success",
ResultDescription has "Onload finished with error", "Error",
ResultDescription has "Skipped item", "Skipped",
"Other"
)
| where EventType in ("Success", "Error", "Skipped")
| project TimeGenerated, jobIdToCheck, EventType, ResultDescription
| order by TimeGenerated asc
To save the queries in Log Analytics for later use, follow these steps:
Copy the KQL query code that is provided above into the New Query pane.
Click on Save => Save as query and specify a name for the query.
Navigate to Log Analytics in your ShArc App Service
Search for and open the saved KQL query
Configure the query parameters
For the Job Statistics Query, specify the time range according to your needs:
For the Job Details Query, specify the job id in the query as well as time range and number of results that should be shown:
The maximum number of results that you can retrieve in the Log Analytics portal experience is 30,000. However, when you share a Log Analytics query with Excel or PowerBI, the maximum limit is 500,000.
The maximum number of results that you can retrieve in the Log Analytics portal experience is 30,000. However, when you share a Log Analytics query with Excel or PowerBI, the maximum limit is 500,000.