# @file
# @brief CII Postinstall
#
# @copyright
#   SPDX-FileCopyrightText: 2020-2025 European Southern Observatory (ESO) @n
#   SPDX-License-Identifier: LGPL-3.0-only

/var/log/elt/elt.log
{
    notifempty
    missingok

    # by time or size or both, and number of files to keep
    daily
    # maxsize 1G
    rotate 5

    # time-stamped names are simpler to handle for both scripts and users
    # timestamps must work intra-day since we also allow rotation by size
    dateext
    dateformat -%Y%m%d-%H%M

    # cii log viewer only cares for .log files
    extension .log

    # note: sharedscripts does not affect preremove
    preremove
       cii-logrotate-attic "/var/log/elt/attic,none,gzip" $1
    endscript

    # notify rsyslog once after rotation
    sharedscripts
    postrotate
      systemctl kill -s HUP rsyslog.service >/dev/null 2>&1 || true
    endscript
}
