# Copyright 2017, Cumulus Networks, Inc.  All rights reserved.
/var/log/switchd.log {
        size 500k
        sharedscripts
        delaycompress
        missingok
        compress
        rotate 14
        nocreate
        include /etc/logrotate.d/cumulus.savefast
        postrotate
                # switchd can log with the file: method, or the default syslog:
                # method, so we might need to signal either switchd or rsyslogd.
                # To simplify things, we use lsof to get the PID, normally
                # for the .1 file that was just rotated. Check both, just in
                # case. if using file logging, switchd might not be running, so
                # exit 0 at end. If rsyslog is doing HUP processing, it might
                # have it open either; /var/log/switchd might not yet be
                # created, so hide lsof errors
                # Only want to match on switchd or any of the syslog
                # variants, not things like tail -F /var/log/switchd.log
                pid=$(lsof -t -a -c /syslog/ -c /switchd/ /var/log/switchd.log \
                      /var/log/switchd.log.1 2>/dev/null)
                [ -n "$pid" ] && kill -HUP $pid
                exit 0
        endscript
}
