Skip to content

Ensure logrotate is Installed

An XCCDF Rule

Description

logrotate is installed by default. The logrotate package can be installed with the following command:

 $ sudo yum install logrotate

Rationale

The logrotate package provides the logrotate services.

ID
xccdf_org.ssgproject.content_rule_package_logrotate_installed
Severity
Medium
References
Updated



Remediation - Shell Script

# Remediation is applicable only in certain platforms
if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then

if ! rpm -q --quiet "logrotate" ; then
    yum install -y "logrotate"
fi

Remediation - Anaconda Pre-Install Instructions


package --add=logrotate

Remediation - OS Build Blueprint


[[packages]]
name = "logrotate"
version = "*"

Remediation - Ansible

- name: Ensure logrotate is installed
  package:
    name: logrotate
    state: present
  when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"]
  tags:

Remediation - Puppet

include install_logrotate

class install_logrotate {
  package { 'logrotate':
    ensure => 'installed',
  }