# Ensure logrotate is configured

Necessity: The 'logrotate' utility is essential for managing log files on a system. Without it, log files can grow indefinitely, eventually consuming all available disk space. This can lead to a denial-of-service condition, causing system instability and application failures. Log rotation automates the process of archiving old log files and creating new ones, making logs manageable and preventing disk space exhaustion.

Auditing and Remediation: The audit script verifies the presence of the 'logrotate' package, which is the standard utility for this function on CentOS systems. The remediation script ensures this fundamental utility is installed using the system's native package manager (yum/dnf), thereby enabling log management capabilities.

Recommended State Rationale: The recommended state for Basic, Moderate, and Strict levels is 'Installed'. This is a foundational system administration and security requirement. There is no lesser or intermediate state; the utility must be present to prevent a critical and common cause of system failure. Its absence poses a direct threat to system availability, making its installation a non-negotiable baseline for any security posture.

## Recommended State Configuration

| Security Level | Value |
|----------------|-------|
| **Basic** | `['Installed']` |
| **Moderate** | `['Installed']` |
| **Strict** | `['Installed']` |
| **Type** | `ENUM` |

## Audit Script Working

Bash script that checks if the 'logrotate' package is installed using the `rpm -q logrotate` command. The script must output only the string 'Installed' if the package is present, or 'Not Installed' if it is not. Ensure no other text or formatting is included in the output.

## Remediation Script Working

Bash script that accepts a single positional command-line argument, which will be the desired state ('Installed'). If the argument is 'Installed', the script must use the system's package manager (e.g., `yum install -y logrotate`) to install the package. The script must return the boolean `true` on successful installation or if the package is already present, and `false` on failure.

