Exemplo n.º 1
0
"""
Real time log files watcher supporting log rotation.

Author: Giampaolo Rodola' <g.rodola [AT] gmail [DOT] com>
License: MIT
"""
from conf import Config
import os
import time
import errno
import stat
import smtplib

config = Config()
conf =  config.getconfig('acl-hive.cfg')

log_location=conf['mnt_log_location']
smtp_host=conf['mnt_smtp_host']
smtp_user=conf['mnt_smtp_user']
smtp_passwd=conf['mnt_smtp_passwd']
sender = conf['mnt_sender']
receivers = conf['mnt_receivers'].split(',')

class LogWatcher(object):
    """Looks for changes in all files of a directory.
    This is useful for watching log file changes in real-time.
    It also supports files rotation.

    Example: