{"id":13446179,"url":"https://github.com/plecos/logrotatewin","last_synced_at":"2026-03-10T02:02:43.274Z","repository":{"id":26098416,"uuid":"29542512","full_name":"plecos/logrotatewin","owner":"plecos","description":"This is a Windows implementation of the logrotate utility found in Linux platforms. The goal is to use the same command line parameters and files as the Linux version.","archived":false,"fork":false,"pushed_at":"2025-12-26T00:55:01.000Z","size":295,"stargazers_count":128,"open_issues_count":0,"forks_count":43,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-12-27T10:57:59.849Z","etag":null,"topics":["automation","csharp","devops","dotnet","log-management","log-rotation","logrotate","sysadmin","system-administration","windows"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/plecos.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}},"created_at":"2015-01-20T17:35:45.000Z","updated_at":"2025-12-26T00:55:00.000Z","dependencies_parsed_at":"2022-07-27T06:16:06.566Z","dependency_job_id":null,"html_url":"https://github.com/plecos/logrotatewin","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/plecos/logrotatewin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plecos%2Flogrotatewin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plecos%2Flogrotatewin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plecos%2Flogrotatewin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plecos%2Flogrotatewin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/plecos","download_url":"https://codeload.github.com/plecos/logrotatewin/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plecos%2Flogrotatewin/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30322635,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-10T01:36:58.598Z","status":"online","status_checked_at":"2026-03-10T02:00:06.579Z","response_time":106,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["automation","csharp","devops","dotnet","log-management","log-rotation","logrotate","sysadmin","system-administration","windows"],"created_at":"2024-07-31T05:00:47.715Z","updated_at":"2026-03-10T02:02:43.268Z","avatar_url":"https://github.com/plecos.png","language":"C#","funding_links":["https://buymeacoffee.com/kenasalter"],"categories":["C#"],"sub_categories":[],"readme":"# logrotatewin\r\nThis is a Windows implementation of the logrotate utility found in Linux platforms. The goal is to use the same command line parameters and files as the Linux version.\r\n\r\nLogRotate for Windows\r\nWritten by Ken Salter (C) 2012-2025\r\n\r\n[![SourceForge Downloads](https://img.shields.io/sourceforge/dt/logrotatewin?label=Sourceforge)\r\n](https://sourceforge.net/projects/logrotatewin/files/latest/download) [![Chocolatey Downloads](https://img.shields.io/chocolatey/dt/logrotate?label=Chocolatey)](https://community.chocolatey.org/packages/LogRotate/)\r\n\r\n\r\nYou can help support my efforts by buying me a coffee!\r\nhttps://buymeacoffee.com/kenasalter\r\n\r\nThis program is free software: you can redistribute it and/or modify\r\nit under the terms of the GNU General Public License as published by\r\nthe Free Software Foundation, either version 3 of the License, or\r\n(at your option) any later version.\r\n\r\nThis program is distributed in the hope that it will be useful,\r\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\r\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r\nGNU General Public License for more details.\r\n\r\nYou should have received a copy of the GNU General Public License\r\nalong with this program.  If not, see \u003chttp://www.gnu.org/licenses/\u003e.\r\n\r\nProgram description:\r\n\r\nThis is a port of the logrotate utility available for Linux. See the Wiki for more notes.\r\n\r\n**Feature Coverage**: Implements **91%** (63/69) of Linux logrotate directives. See [DIRECTIVE_COMPARISON.md](DIRECTIVE_COMPARISON.md) for complete directive coverage details.\r\n\r\nhttps://sourceforge.net/projects/logrotate/\r\n\r\n## Requirements\r\n\r\n.NET Framework 4.8 or better\r\n\r\n## Installation\r\n\r\n### Chocolatey (Recommended)\r\n\r\nThe easiest way to install LogRotate for Windows is using Chocolatey:\r\n\r\n```powershell\r\nchoco install logrotate\r\n```\r\n\r\nAfter installation, the `logrotate` command will be available in your PATH.\r\n\r\n### Manual Installation\r\n\r\nDownload the latest release from the [Releases page](https://github.com/ken-salter/logrotatewin/releases) and extract to your desired location.\r\n\r\n## Building\r\n\r\nThe project uses SDK-style project format and can be built using:\r\n- Visual Studio 2019 or later\r\n- Visual Studio Code with C# extension\r\n- .NET SDK 6.0 or later (for tooling)\r\n\r\nBuild from command line:\r\n```\r\ndotnet build\r\n```\r\n\r\nBuild Release configuration:\r\n```\r\ndotnet build -c Release\r\n```\r\n\r\n## Testing\r\n\r\nThe project includes comprehensive integration tests covering all major directives and functionality:\r\n\r\n```bash\r\ndotnet test\r\n```\r\n\r\nFor more information about testing, see [TESTING.md](TESTING.md).\r\n\r\n## Documentation\r\n\r\n- **[DIRECTIVE_COMPARISON.md](DIRECTIVE_COMPARISON.md)** - Complete comparison of implemented directives vs Linux logrotate\r\n- **[TESTING.md](TESTING.md)** - Comprehensive testing documentation\r\n- **[EXIT-CODES.md](EXIT-CODES.md)** - Exit code reference\r\n\r\n## Usage\r\n\r\n```\r\nlogrotate [options] \u003cconfigfile\u003e\r\n```\r\n\r\n### Command Line Options\r\n\r\n- `-d, --debug` - Debug mode (verbose output, no actual rotation)\r\n- `-f, --force` - Force rotation even if not needed\r\n- `-v, --verbose` - Verbose output\r\n- `-s, --state \u003cfile\u003e` - Use alternate state file\r\n- `-?, --usage, --help` - Show usage information\r\n\r\n### Configuration File Directives\r\n\r\nLogRotate for Windows supports 63 configuration directives (91% of Linux logrotate directives) plus 7 Windows-specific directives. Configuration files use the same syntax as Linux logrotate.\r\n\r\n**Example configuration:**\r\n```\r\n/var/log/myapp/*.log {\r\n    daily\r\n    rotate 7\r\n    compress\r\n    delaycompress\r\n    missingok\r\n    notifempty\r\n    create 0644\r\n    postrotate\r\n        echo \"Logs rotated\" \u003e\u003e /var/log/rotation.log\r\n    endscript\r\n}\r\n```\r\n\r\n**Key directive categories:**\r\n- **Rotation scheduling**: `hourly`, `daily`, `weekly`, `monthly`, `yearly`, `size`, `minsize`, `maxsize`\r\n- **Compression**: `compress`, `nocompress`, `delaycompress`, `compresscmd`, `compressoptions`\r\n- **File handling**: `create`, `copy`, `copytruncate`, `renamecopy`, `olddir`, `missingok`\r\n- **File naming**: `dateext`, `dateformat`, `dateyesterday`, `datehourago`, `extension`, `addextension`\r\n- **Cleanup**: `rotate`, `maxage`, `minage`, `shred`, `shredcycles`\r\n- **Scripts**: `prerotate`, `postrotate`, `firstaction`, `lastaction`, `preremove`, `sharedscripts`\r\n- **Mail**: `mail`, `mailfirst`, `maillast`\r\n- **Configuration**: `include`, `tabooext`, `taboopat`\r\n\r\nFor a complete list of all supported directives, see [DIRECTIVE_COMPARISON.md](DIRECTIVE_COMPARISON.md).\r\n\r\n### Exit Codes\r\n\r\nLogRotate for Windows uses standard exit codes to indicate success or failure:\r\n\r\n| Exit Code | Name | Description |\r\n|-----------|------|-------------|\r\n| 0 | SUCCESS | Successful execution |\r\n| 1 | GENERAL_ERROR | General runtime error or exception |\r\n| 2 | INVALID_ARGUMENTS | Invalid command line arguments |\r\n| 3 | CONFIG_ERROR | Configuration file not found or invalid |\r\n| 4 | NO_FILES_TO_ROTATE | No log files found to process |\r\n\r\nThese exit codes can be used in scripts to determine the result of the operation:\r\n\r\n```powershell\r\nlogrotate myconfig.conf\r\nif ($LASTEXITCODE -eq 0) {\r\n    Write-Host \"Rotation completed successfully\"\r\n} elseif ($LASTEXITCODE -eq 4) {\r\n    Write-Host \"No files to rotate\"\r\n} else {\r\n    Write-Host \"Error occurred: exit code $LASTEXITCODE\"\r\n}\r\n```\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplecos%2Flogrotatewin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fplecos%2Flogrotatewin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplecos%2Flogrotatewin/lists"}