From 7e5b6eac939f677d581a89ebe09080160c277411 Mon Sep 17 00:00:00 2001 From: Andrew Lorimer Date: Mon, 11 Mar 2019 20:34:41 +1100 Subject: [PATCH] writing disk usage now depends on logrotate config --- logparse.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/logparse.py b/logparse.py index 8906802..896e764 100755 --- a/logparse.py +++ b/logparse.py @@ -45,7 +45,7 @@ config = { 'sys': '/var/log/syslog', 'smb': '/var/log/samba', 'zfs': '/var/log/zpool.log', - 'alloc': '/tmp/alloc', + 'alloc': '/var/log/du.log', 'postfix': '/var/log/mail.log', 'httpd': '/var/log/apache2' } @@ -126,7 +126,7 @@ def __main__(): closetag(tag, 1) tempfile.close() mailprep(config['output'], MAILPATH) - if (config['mail']['to'] != None): + if (config['mail']['to']): logger.debug("sending email") ms = subject(config['mail']['subject']) cmd = "/bin/cat " + MAILPATH + " | /usr/bin/mail --debug-level=10 -a 'Content-type: text/html' -s '" + ms + "' " + config['mail']['to'] @@ -765,7 +765,8 @@ def du(): else: out.append([p, "used " + parsesize(alloc_f), "delta " + parsesize(delta)]) contentnew += (p + '\t' + str(alloc_f) + '\n') - writelog('alloc', contentnew) + if config['rotate'] == 'y': + writelog('alloc', contentnew) writetitle("du") logger.debug("disk usage data is " + str(out)) -- 2.47.1