{"id":19442981,"url":"https://github.com/samcook/azurediagnosticscleanup","last_synced_at":"2026-05-07T13:42:56.909Z","repository":{"id":232739657,"uuid":"785072981","full_name":"samcook/AzureDiagnosticsCleanup","owner":"samcook","description":"A utility for cleaning up Azure Diagnostics tables from Azure Storage","archived":false,"fork":false,"pushed_at":"2024-04-12T05:32:37.000Z","size":14,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-25T07:47:29.918Z","etag":null,"topics":["azure","azure-storage","azure-storage-table","c-sharp","dotnet"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/samcook.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-04-11T06:22:15.000Z","updated_at":"2025-01-24T13:50:38.000Z","dependencies_parsed_at":null,"dependency_job_id":"9dc8885c-474e-4c07-8ff6-ca1511490e36","html_url":"https://github.com/samcook/AzureDiagnosticsCleanup","commit_stats":null,"previous_names":["samcook/azurediagnosticscleanup"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/samcook/AzureDiagnosticsCleanup","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samcook%2FAzureDiagnosticsCleanup","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samcook%2FAzureDiagnosticsCleanup/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samcook%2FAzureDiagnosticsCleanup/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samcook%2FAzureDiagnosticsCleanup/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/samcook","download_url":"https://codeload.github.com/samcook/AzureDiagnosticsCleanup/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samcook%2FAzureDiagnosticsCleanup/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264029836,"owners_count":23546552,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["azure","azure-storage","azure-storage-table","c-sharp","dotnet"],"created_at":"2024-11-10T15:41:37.089Z","updated_at":"2026-05-07T13:42:51.890Z","avatar_url":"https://github.com/samcook.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AzureDiagnosticsCleanup\n\nA utility to clean up Azure Diagnostics logs tables in an Azure Storage Account.\n\nOver time the diagnostics tables can grow to a large size, and they are not automatically trimmed.\n\n## Usage\n\nObtain the URL of the Azure Table Storage account.\n\nThe `SASToken` auth mode requires a SAS token with enough permissions to read and delete tables and entities.\n\nThe `EntraID` auth mode attempts to authenticate using Azure Entra ID (see [`DefaultAzureCredential`](https://learn.microsoft.com/en-us/dotnet/api/azure.identity.defaultazurecredential) for details about which mechanisms are tried). Ensure the identity has the `Storage Table Data Contributor` role.\n\nUpdate the `config.json` file with the appropriate settings, or pass values on the command line.\n\n### Modes\n\n#### WAD Metrics\n\nThese metrics are stored in tables with the prefix `WADMetrics`, with a new table created every 10 days. Cleanup is relatively easy, as we can just drop older tables.\n\n```\nAzureDiagnosticsCleanup.exe --mode WADMetrics --cutoffdate 2024-01-01T00:00:00Z\n```\n\n#### WAD Logs\n\nThese logs are stored in tables such as `WADPerformanceCountersTable`, `WADWindowsEventLogsTable` and `WADDiagnosticInfrastructureLogsTable`.\n\nAny table with `PartitionKey` values such as `0638308144800000000` (which is a `DateTime.Ticks` value representing the time the log was written) can be cleaned up in this mode.\n\nDue to the fact that all of the records are stored in a single table, in order to clean up entries without dumping everything we need to query all the entities with a `PartitionKey` value less than the cutoff date, and then delete them. As a result this mode can be slow. Running the cleanup from a host within Azure can help throughput significantly.\n\n```\nAzureDiagnosticsCleanup.exe --mode WADData --Data:TableName WADPerformanceCountersTable --cutoffdate 2024-01-01T00:00:00Z\n```\n\n#### Linux Logs\n\nSimilar to WAD Logs, these logs are stored in tables such as `LinuxCpuVer2v0`, `LinuxDiskVer2v0`, `LinuxMemoryVer2v0` and `LinuxsyslogVer2v0`.\n\nThe partition key format for this mode is `0000000000000000001___0636951868800000000` (where the first section's last digit is `0` through `9`, and the second section is a `DateTime.Ticks` value representing the time the log entry was written).\n\nThis mode also requires querying all entities with a `PartitionKey` value less than the cutoff date, and then deleting them.\n\n```\nAzureDiagnosticsCleanup.exe --mode LinuxData --Data:TableName LinuxCpuVer2v0 --cutoffdate 2024-01-01T00:00:00Z\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamcook%2Fazurediagnosticscleanup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsamcook%2Fazurediagnosticscleanup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamcook%2Fazurediagnosticscleanup/lists"}