Summary
- The meeting provided an overview and detailed discussion around the configuration and operation of the logrotate utility, which automates the rotation, compression, and removal or mailing of system log files.
- Attendees reviewed command-line options, configuration file structures, supported directives, and scripting integration, along with key files and reference resources.
- No major decisions or action items were generated, as the meeting served primarily as a technical walkthrough and Q&A platform for logrotate setup and troubleshooting.
Action Items
(No action items were assigned during this meeting.)
Introduction and Overview of logrotate
- logrotate is used to automatically rotate, compress, and manage log files, especially for systems generating a large number of logs.
- Typical use involves running logrotate as a daily cron job, handling log files according to specified criteria (time, size, etc.).
- Multiple configuration files can be supplied; order of precedence is important.
Command-Line Options
- logrotate offers options such as
--force, --debug, --state, --skip-state-lock, --wait-for-state-lock, --verbose, --log, and --mail.
- Debug and force options help with troubleshooting and testing new configurations.
- State file handling and locking mechanisms were explained to avoid parallel executions and manage multiple runs/users.
Configuration File Structure
- logrotate uses configuration files to define how and when logs are rotated, compressed, removed, or mailed.
- Global options may be set, but can be overridden by local definitions or later file inclusions.
- Wildcards and file patterns are supported for batch operations, though caution is advised when using them.
Configuration File Directives
- Directives control rotation (frequency, count, target directories), file handling (creation/deletion/copying), compression settings, naming conventions, mailing, and script execution.
- Rotation options include time-based (hourly, daily, weekly, monthly, yearly), size-based, and combined approaches (minsize, maxsize).
- File selection and error handling options (missingok, ifempty, etc.) can be customized.
- Compression can be adjusted, including tool choice, options, and delay of compression.
- Filenames, extensions, and timestamping of rotated logs are configurable.
- Scripts (prerotate, postrotate, preremove, etc.) can be tied to rotation actions for advanced management.
- Security precautions, particularly around file permissions and the include directive, were highlighted.
Scripts and Automation
- Scripts embedded in the configuration can perform actions before or after rotation, or upon removal.
- Shared vs. individual script execution for wildcarded patterns is configurable.
- Scripts inherit the environment and are executed under the invoking user's privileges.
User and Group Handling
- File ownership for rotated logs can be set via the
su directive, supporting both textual and numeric user/group IDs.
Key Files and References
- Default state and configuration files:
/var/lib/logrotate/status and /etc/logrotate.conf.
- Reference was made to related utilities: chmod, gunzip, gzip, mail, shred, strftime, strtoul, along with the logrotate GitHub repository.
Decisions
- (No new decisions were made in this meeting.)
Open Questions / Follow-Ups
- (No open questions or follow-up items were recorded.)