- subprocess.call("/usr/sbin/logrotate -f /etc/logrotate.conf", shell=True)
- logger.info("rotated logfiles")
+ # rotate logs using systemd logrotate
+ if (config['rotate'] == 1):
+ subprocess.call("/usr/sbin/logrotate -f /etc/logrotate.conf", shell=True)
+ logger.info("rotated logfiles")
+ else:
+ logger.info("user doesn't want to rotate logs")
+ logger.debug("Here is the output of `logrotate -d /etc/logrotate.conf` (simulated):")
+ sim = subprocess.check_output("/usr/sbin/logrotate -d /etc/logrotate.conf", shell=True)
+ logger.debug(sim)
+ timenow = time.strftime("%H:%M:%S")
+ datenow = time.strftime("%x")
+ logger.info("finished parsing logs at " + str(datenow) + ' ' + str(timenow))