{"id":14994560,"url":"https://github.com/voxpupuli/puppet-logrotate","last_synced_at":"2025-10-03T10:30:18.801Z","repository":{"id":28104939,"uuid":"31603299","full_name":"voxpupuli/puppet-logrotate","owner":"voxpupuli","description":"Puppet logrotate module","archived":false,"fork":true,"pushed_at":"2025-09-23T13:16:52.000Z","size":639,"stargazers_count":27,"open_issues_count":17,"forks_count":92,"subscribers_count":22,"default_branch":"master","last_synced_at":"2025-09-26T08:25:59.271Z","etag":null,"topics":["bsd-puppet-module","centos-puppet-module","debian-puppet-module","freebsd-puppet-module","gentoo-puppet-module","hacktoberfest","linux-puppet-module","oraclelinux-puppet-module","puppet","redhat-puppet-module","scientific-puppet-module","ubuntu-puppet-module"],"latest_commit_sha":null,"homepage":"https://forge.puppet.com/puppet/logrotate","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"rodjek/puppet-logrotate","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/voxpupuli.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null},"funding":{"open_collective":"vox-pupuli","github":"voxpupuli"}},"created_at":"2015-03-03T14:45:56.000Z","updated_at":"2025-09-23T13:16:55.000Z","dependencies_parsed_at":"2023-09-27T15:55:36.051Z","dependency_job_id":null,"html_url":"https://github.com/voxpupuli/puppet-logrotate","commit_stats":{"total_commits":324,"total_committers":68,"mean_commits":4.764705882352941,"dds":0.7592592592592593,"last_synced_commit":"ec9d5cf7a41d1a67db357c35dbe92b32c895c570"},"previous_names":["yo61/puppet-logrotate"],"tags_count":32,"template":false,"template_full_name":null,"purl":"pkg:github/voxpupuli/puppet-logrotate","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voxpupuli%2Fpuppet-logrotate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voxpupuli%2Fpuppet-logrotate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voxpupuli%2Fpuppet-logrotate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voxpupuli%2Fpuppet-logrotate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/voxpupuli","download_url":"https://codeload.github.com/voxpupuli/puppet-logrotate/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voxpupuli%2Fpuppet-logrotate/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":277166390,"owners_count":25772285,"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","status":"online","status_checked_at":"2025-09-26T02:00:09.010Z","response_time":78,"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":["bsd-puppet-module","centos-puppet-module","debian-puppet-module","freebsd-puppet-module","gentoo-puppet-module","hacktoberfest","linux-puppet-module","oraclelinux-puppet-module","puppet","redhat-puppet-module","scientific-puppet-module","ubuntu-puppet-module"],"created_at":"2024-09-24T16:03:52.577Z","updated_at":"2025-10-03T10:30:18.794Z","avatar_url":"https://github.com/voxpupuli.png","language":"Ruby","funding_links":["https://opencollective.com/vox-pupuli","https://github.com/sponsors/voxpupuli"],"categories":[],"sub_categories":[],"readme":"# Logrotate module for Puppet\n\n[![License](https://img.shields.io/github/license/voxpupuli/puppet-logrotate.svg)](https://github.com/voxpupuli/puppet-logrotate/blob/master/LICENSE)\n[![Build Status](https://travis-ci.org/voxpupuli/puppet-logrotate.png?branch=master)](https://travis-ci.org/voxpupuli/puppet-logrotate)\n[![Puppet Forge](https://img.shields.io/puppetforge/v/puppet/logrotate.svg)](https://forge.puppetlabs.com/puppet/logrotate)\n[![Puppet Forge - downloads](https://img.shields.io/puppetforge/dt/puppet/logrotate.svg)](https://forge.puppetlabs.com/puppet/logrotate)\n[![Puppet Forge - endorsement](https://img.shields.io/puppetforge/e/puppet/logrotate.svg)](https://forge.puppetlabs.com/puppet/logrotate)\n[![Puppet Forge - scores](https://img.shields.io/puppetforge/f/puppet/logrotate.svg)](https://forge.puppetlabs.com/puppet/logrotate)\n\n## Description\n\nA more Puppety way of managing logrotate configs.  Where possible, as many of\nthe configuration options have remained the same with a couple of notable\nexceptions:\n\n * Booleans are now used instead of the `\u003csomething\u003e`/`no\u003csomething\u003e` pattern.\n   e.g. `copy` == `copy =\u003e true`, `nocopy` == `copy =\u003e false`.\n * `create` and its three optional arguments have been split into seperate\n   parameters documented below.\n * Instead of 'daily', 'weekly', 'monthly' or 'yearly', there is a\n   `rotate_every` parameter (see documentation below).\n\n## logrotate::conf\n\nYou may, optionally, define logrotate defaults using this defined type.\nParameters are the same as those for logrotate::rule.\nUsing this type will automatically include a private class that will install\nand configure logrotate for you.\nYou must not also declare the `logrotate` class if using this defined type as you will encounter a Puppet error if you attempt to do so.\n\n## logrotate::rule\n\nThe only thing you'll need to deal with, this type configures a logrotate rule.\nUsing this type will automatically include a private class that will install\nand configure logrotate for you.\n\n**Important**: in Hiera, use logrotate::rules (rule**s**, not rule)\n\n```\nnamevar         - The String name of the rule.\npath            - The path(s) to the log file(s) to be rotated.  May be a\n                  String or an Array of Strings.\nensure          - The desired state of the logrotate rule as a String.  Valid\n                  values are 'absent' and 'present' (default: 'present').\ncompress        - A Boolean value specifying whether the rotated logs should\n                  be compressed (optional).\ncompresscmd     - The command String that should be executed to compress the\n                  rotated logs (optional).\ncompressext     - The extention String to be appended to the rotated log files\n                  after they have been compressed (optional).\ncompressoptions - A String of command line options to be passed to the\n                  compression program specified in `compresscmd` (optional).\ncopy            - A Boolean specifying whether logrotate should just take a\n                  copy of the log file and not touch the original (optional).\ncopytruncate    - A Boolean specifying whether logrotate should truncate the\n                  original log file after taking a copy (optional).\ncreate          - A Boolean specifying whether logrotate should create a new\n                  log file immediately after rotation (optional).\ncreate_mode     - An octal mode String logrotate should apply to the newly\n                  created log file if create =\u003e true (optional).\ncreate_owner    - A username String that logrotate should set the owner of the\n                  newly created log file to if create =\u003e true (optional).\ncreate_group    - A String group name that logrotate should apply to the newly\n                  created log file if create =\u003e true (optional).\ndateext         - A Boolean specifying whether rotated log files should be\n                  archived by adding a date extension rather just a number\n                  (optional).\ndateformat      - The format String to be used for `dateext` (optional).\n                  Valid specifiers are '%Y', '%m', '%d' and '%s'.\ndateyesterday   - A Boolean specifying whether to use yesterday's date instead\n                  of today's date to create the `dateext` extension (optional).\ndelaycompress   - A Boolean specifying whether compression of the rotated\n                  log file should be delayed until the next logrotate run\n                  (optional).\nextension       - Log files with this extension String are allowed to keep it\n                  after rotation (optional).\nifempty         - A Boolean specifying whether the log file should be rotated\n                  even if it is empty (optional).\nmail            - The email address String that logs that are about to be\n                  rotated out of existence are emailed to (optional).\nmailfirst       - A Boolean that when used with `mail` has logrotate email the\n                  just rotated file rather than the about to expire file\n                  (optional).\nmaillast        - A Boolean that when used with `mail` has logrotate email the\n                  about to expire file rather than the just rotated file\n                  (optional).\nmaxage          - The Integer maximum number of days that a rotated log file\n                  can stay on the system (optional).\nminsize         - The String minimum size a log file must be to be rotated,\n                  but not before the scheduled rotation time (optional).\n                  The default units are bytes, append k, M or G for kilobytes,\n                  megabytes and gigabytes respectively.\nmaxsize         - The String maximum size a log file may be to be rotated;\n                  When maxsize is used, both the size and timestamp of a log\n                  file are considered for rotation.\n                  The default units are bytes, append k, M or G for kilobytes,\n                  megabytes and gigabytes respectively.\nmissingok       - A Boolean specifying whether logrotate should ignore missing\n                  log files or issue an error (optional).\nolddir          - A String path to a directory that rotated logs should be\n                  moved to (optional).\npostrotate      - A command String that should be executed by /bin/sh after\n                  the log file is rotated (optional).\nprerotate       - A command String that should be executed by /bin/sh before\n                  the log file is rotated and only if it will be rotated\n                  (optional).\nfirstaction     - A command String that should be executed by /bin/sh once\n                  before all log files that match the wildcard pattern are\n                  rotated (optional).\nlastaction      - A command String that should be execute by /bin/sh once\n                  after all the log files that match the wildcard pattern are\n                  rotated (optional).\nrotate          - The Integer number of rotated log files to keep on disk\n                  (optional).\nrotate_every    - How often the log files should be rotated as a String.\n                  Valid values are 'hour', 'day', 'week', 'month' and 'year'\n                  (optional).  Please note, older versions of logrotate do not\n                  support yearly log rotation.\nsize            - The String size a log file has to reach before it will be\n                  rotated (optional).  The default units are bytes, append k,\n                  M or G for kilobytes, megabytes or gigabytes respectively.\nsharedscripts   - A Boolean specifying whether logrotate should run the\n                  postrotate and prerotate scripts for each matching file or\n                  just once (optional).\nshred           - A Boolean specifying whether logs should be deleted with\n                  shred instead of unlink (optional).\nshredcycles     - The Integer number of times shred should overwrite log files\n                  before unlinking them (optional).\nstart           - The Integer number to be used as the base for the extensions\n                  appended to the rotated log files (optional).\nsu              - A Boolean specifying whether logrotate should rotate under\n                  the specific su_owner and su_group instead of the default (optional).\nsu_user         - A username String that logrotate should use to rotate a\n                  log file set instead of using the default if\n                  su =\u003e true (optional).\nsu_group        - A String group name that logrotate should use to rotate a\n                  log file set instead of using the default if\n                  su =\u003e true (optional).\nuncompresscmd   - The String command to be used to uncompress log files\n                  (optional).\n```\n\nFurther details about these options can be found by reading `man 8 logrotate`.\n\n## logrotate\n\nYou may, optionally, declare the main `::logrotate` class to adjust some of the\ndefaults that are used when installing the logrotate package and creating the\nmain `/etc/logrotate.conf` configuration file.\n\nThis example will ensure that the logrotate package is latest and that the `dateext` and `compress` options are added to the defaults for a node.\n\n```puppet\nclass { 'logrotate':\n  ensure =\u003e 'latest',\n  config =\u003e {\n    dateext      =\u003e true,\n    compress     =\u003e true,\n    rotate       =\u003e 10,\n    rotate_every =\u003e 'week',\n    ifempty      =\u003e true,\n  }\n}\n```\n\n### Additional startup arguments\n\nWith parameter `logrotate_args` you can specify additional startup arguments for logrotate. Configuration file is always added as the last argument for logrotate.\n\nThis example tells logrotate to use an alternate state file and which command to use when mailing logs.\n\n```puppet\nclass { 'logrotate':\n  ensure         =\u003e 'latest',\n  logrotate_args =\u003e ['-s /var/lib/logrotate/logrotate.status', '-m /usr/local/bin/mailer']\n}\n```\n\n### Cron output\n\nBy default, the cron output is discarded if there is no error output. To enable this output, when you (for example) enable the verbose startup argument, enable the `cron_always_output` boolean on the logrotate class:\n\n```puppet\nclass { 'logrotate':\n  ensure              =\u003e 'latest',\n  cron_always_output  =\u003e true,\n  config              =\u003e {\n    ...\n  }\n}\n```\n\n## Examples\n\n### Puppet\n\n```puppet\nlogrotate::conf { '/etc/logrotate.conf':\n  rotate       =\u003e 10,\n  rotate_every =\u003e 'week',\n  ifempty      =\u003e true,\n  dateext      =\u003e true,\n}\n\nlogrotate::rule { 'messages':\n  path         =\u003e '/var/log/messages',\n  rotate       =\u003e 5,\n  rotate_every =\u003e 'week',\n  postrotate   =\u003e '/usr/bin/killall -HUP syslogd',\n}\n\nlogrotate::rule { 'servicelogs':\n  path         =\u003e ['/var/log/this-service.log', '/var/log/that-app.log'],\n  rotate       =\u003e 5,\n  rotate_every =\u003e 'day',\n  postrotate   =\u003e '/usr/bin/kill -HUP `cat /run/syslogd.pid`',\n}\n\nlogrotate::rule { 'apache':\n  path          =\u003e '/var/log/httpd/*.log',\n  rotate        =\u003e 5,\n  mail          =\u003e 'test@example.com',\n  size          =\u003e '100k',\n  sharedscripts =\u003e true,\n  postrotate    =\u003e '/etc/init.d/httpd restart',\n}\n```\n\n### Hiera\n\n**Important**: in Hiera, use logrotate::rules (rule**s**, not rule)\n\n```yaml\nlogrotate::config:\n  rotate: 10\n  rotate_every: 'week'\n  ifempty: true\n  dateext: true\n\nlogrotate::rules:\n  messages:\n    path: '/var/log/messages'\n    rotate: 5\n    rotate_every: 'week'\n    postrotate: '/usr/bin/killall -HUP syslogd'\n  servicelogs:\n    path: ['/var/log/this-service.log', '/var/log/that-app.log']\n    rotate: 5\n    rotate_every: 'day'\n    postrotate: '/usr/bin/kill -HUP `cat /run/syslogd.pid`'\n  apache:\n    path: '/var/log/httpd/*.log'\n    rotate: 5\n    mail: 'test@example.com'\n    size: '100k'\n    sharedscripts: true\n    postrotate: '/etc/init.d/httpd restart'\n```\n\n### Result\nThis example will create/edit these files:\n```\n├── logrotate.conf\n└── logrotate.d\n    ├── apache\n    ├── messages\n    └── servicelogs\n```\n\n## Authors and Module History\n\nPuppet-logrotate has been maintained by VoxPupuli since version 2.0.0.\nIt was migrated from https://forge.puppet.com/yo61/logrotate.\nyo61's version was a fork of https://github.com/rodjek/puppet-logrotate.\nIt is licensed under the MIT license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvoxpupuli%2Fpuppet-logrotate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvoxpupuli%2Fpuppet-logrotate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvoxpupuli%2Fpuppet-logrotate/lists"}