documentation_complete: true

title: 'Ensure Logrotate Runs Periodically'

description: |-
    The <tt>logrotate</tt> utility allows for the automatic rotation of
    log files.  The frequency of rotation is specified in <tt>/etc/logrotate.conf</tt>,
    which triggers a cron task or a timer.  To configure logrotate to run daily, add or correct
    the following line in <tt>/etc/logrotate.conf</tt>:
    <pre># rotate log files <i>frequency</i>
    daily</pre>

rationale: |-
    Log files that are not properly rotated run the risk of growing so large
    that they fill up the /var/log partition. Valuable logging information could be lost
    if the /var/log partition becomes full.

severity: medium

platform: package[logrotate]

identifiers:
    cce@rhcos4: CCE-82689-1
    cce@rhel8: CCE-80794-1
    cce@rhel9: CCE-83993-6
    cce@rhel10: CCE-88779-4
    cce@sle12: CCE-91511-6
    cce@sle15: CCE-85850-6
    cce@slmicro5: CCE-94014-8

references:
    cis-csc: 1,14,15,16,3,5,6
    cis@sle12: "4.2.4"
    cis@sle15: "4.2.4"
    cobit5: APO11.04,BAI03.05,DSS05.04,DSS05.07,MEA02.01
    isa-62443-2009: 4.3.3.3.9,4.3.3.5.8,4.3.4.4.7,4.4.2.1,4.4.2.2,4.4.2.4
    isa-62443-2013: 'SR 2.10,SR 2.11,SR 2.12,SR 2.8,SR 2.9'
    iso27001-2013: A.12.4.1,A.12.4.2,A.12.4.3,A.12.4.4,A.12.7.1
    nist: CM-6(a)
    nist-csf: PR.PT-1
    pcidss: Req-10.7

ocil_clause: 'logrotate is not configured to run daily'

ocil: |-
    To determine the status and frequency of logrotate, run the following command:
    <pre>$ sudo grep logrotate /var/log/cron*</pre>
    If logrotate is configured properly, output should include references to
    <tt>/etc/cron.daily</tt>.
