pygtail stops updating offset file
Hi;
Having an issue where pygtail.py will stop updating the offset file randomly.
I'm using it as part of a Zabbix Postfix monitor.
(scripts here: https://github.com/rafael747/zabbix-postfix/blob/master/zabbix_postfix.sh )
I can see it running (debug output in cron) it processes the postfix mail log but always returns 0 for every stat as the offset does not get updated. (well it will update the offset for a few hours, then just stop updating it with no error it continues to read the log)
The zabbix_postfix.sh is run from a cron job as root, like I say it will run fine for a few hours - so not permissions. I can actually run the script as root and it still will not update unless I delete the offset file.
- are there any further debugging options other than the -vv
- could this have anything to do with the maillog constantly changing (like several times/second)
stumped.
OK. So I think I see the problem, but not a solution (yet) My environment is Centos managed VIA Plesk - log rotation for postfix is handled by a plesk cronjob.
It appears that the data from the log file is moved to a NEW file and cleared from the existing /var/log/maillog
i.e. /var/log/maillog inode never changes. I'm guessing this is why it stops working around 3am.
What is the best solution here to guarantee accurate data?
Convince logrotate that the offset should also be rotated? Update my shell script with a sanity check?
I think maybe a request to have pygtail support files whos inodes don't change (but get smaller) might be in order. (if that is infact what is happening here)