Python syslog.LOG_LOCAL0 Examples

The following are 5 code examples of syslog.LOG_LOCAL0(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module syslog , or try the search function .
Example #1
Source File: laikamilter.py    From laikaboss with Apache License 2.0 6 votes vote down vote up
def loadAll(self):
        self.loadError      = False
        self.loadAttempt   += 1
        self.loadConfig()
        self.loadScanServers()
        self.loadDispositionModes()
        self.loadHeaderOptions()
        
        #Allow config file to reload itself.  If a new config file gets written, it may be unreadable while the new file is written to disk.  Sleep 1 sec and try again when file write is complete. 
        if ((self.loadError) and (self.loadAttempt <= self.maxLoadAttempts)):
            log = "Error loading Config File from loadAll, trying again"
            logger = log2syslog(self.milterName, syslog.LOG_LOCAL0)
            logger.writeLog(syslog.LOG_ERR, "%s"%(str(log)))
            time.sleep(1)
            self.loadAll()
        elif ((self.loadError) and (self.loadAttempt > self.maxLoadAttempts)):
            log = "Error loading Config File from loadAll, using Defaults"
            logger = log2syslog(self.milterName, syslog.LOG_LOCAL0)
            logger.writeLog(syslog.LOG_ERR, "%s"%(str(log))) 
Example #2
Source File: laikamilter.py    From laikaboss with Apache License 2.0 6 votes vote down vote up
def loadDispositionModes(self):
        Config = ConfigParser.ConfigParser()
        try:
            Config.read(self.configFileLoc)
            DispositionModes = Config.items('DispositionMode')
            for DispositionMode in DispositionModes:
                self.dispositionModes[DispositionMode[0]] = self._convertDispositionMode(DispositionMode[1])
                    
                    
        except ConfigParser.NoSectionError:
            if (self.loadAttempt >= self.maxLoadAttempts):
                log = "Error loading Config File for DispositionMode config, USING DEFAULTS"
                logger = log2syslog(self.milterName, syslog.LOG_LOCAL0)
                logger.writeLog(syslog.LOG_ERR, "%s"%(str(log)))
            else:
                self.loadError = True
                log = "Error loading Config File for DispositionMode config, should try again"
                logger = log2syslog(self.milterName, syslog.LOG_LOCAL0)
                logger.writeLog(syslog.LOG_ERR, "%s"%(str(log))) 
Example #3
Source File: laikamilter.py    From laikaboss with Apache License 2.0 6 votes vote down vote up
def loadScanServers(self):
        Config = ConfigParser.ConfigParser()
        try:
            Config.read(self.configFileLoc)
            servers = Config.items('ScanServers')
            for server in servers:
                self.servers.append(server[1])
        except ConfigParser.NoSectionError:
            if (self.loadAttempt >= self.maxLoadAttempts):
                log = "Error loading Config File for ScanServers config, USING DEFAULTS"
                logger = log2syslog(self.milterName, syslog.LOG_LOCAL0)
                logger.writeLog(syslog.LOG_ERR, "%s"%(str(log)))
            else:
                self.loadError = True
                log = "Error loading Config File for ScanServers config, should try again"
                logger = log2syslog(self.milterName, syslog.LOG_LOCAL0)
                logger.writeLog(syslog.LOG_ERR, "%s"%(str(log))) 
Example #4
Source File: laikamilter.py    From laikaboss with Apache License 2.0 5 votes vote down vote up
def loadConfig(self):
        Config = ConfigParser.ConfigParser()
        try:
            Config.read(self.configFileLoc)
            self.socketname     = Config.get('COMMON', 'socketname')
            self.milterName     = Config.get('COMMON', 'MilterName')
            self.milterInstance = Config.get('COMMON', 'MilterInstance')
            self.mode           = Config.get('COMMON', 'mode')
            self.zmqMaxRetry    = int(Config.get('COMMON', 'zmqMaxRetry'))
            self.zmqTimeout     = int(Config.get('COMMON', 'zmqTimeout'))
            self.maxFiles       = int(Config.get('COMMON', 'maxFiles'))
            self.heloWhitelist  = str(Config.get('COMMON', 'helowhitelist'))
            
            self.storeEmails    = self._convertTrueFalse(Config.get('ArchiveOptions', 'storeEmails'))
            self.storeDir       = Config.get('ArchiveOptions', 'storeDir')
            self.customFolderDateFormat = Config.get('ArchiveOptions', 'customFolderDateFormat')
        except ConfigParser.NoSectionError:
            if (self.loadAttempt >= self.maxLoadAttempts):
                log = "Error loading Config File for COMMON config, USING DEFAULTS"
                logger = log2syslog(self.milterName, syslog.LOG_LOCAL0)
                logger.writeLog(syslog.LOG_ERR, "%s"%(str(log)))
            else:
                self.loadError = True
                log = "Error loading Config File for COMMON config, should try again"
                logger = log2syslog(self.milterName, syslog.LOG_LOCAL0)
                logger.writeLog(syslog.LOG_ERR, "%s"%(str(log))) 
Example #5
Source File: laikamilter.py    From laikaboss with Apache License 2.0 5 votes vote down vote up
def loadHeaderOptions(self):
        Config = ConfigParser.ConfigParser()
        try:
            Config.read(self.configFileLoc)
            self.ApplyCustomHeaders           = self._convertTrueFalse(Config.get('HeaderOptions', 'ApplyCustomHeaders'))
            self.CustomHeaderBase           = Config.get('HeaderOptions', 'CustomHeaderBase')
            self.ApplyMailscanResultHeader  = self._convertTrueFalse(Config.get('HeaderOptions', 'ApplyMailscanResultHeader'))
            self.MailscanResultHeaderString = Config.get('HeaderOptions', 'MailscanResultHeaderString')
        except ConfigParser.NoSectionError:
            if (self.loadAttempt >= self.maxLoadAttempts):
                log = "Error loading Config File for HeaderOptions config, USING DEFAULTS"
                logger = log2syslog(self.milterName, syslog.LOG_LOCAL0)
                logger.writeLog(syslog.LOG_ERR, "%s"%(str(log)))
            else:
                self.loadError = True
                log = "Error loading Config File for HeaderOptions config, should try again"
                logger = log2syslog(self.milterName, syslog.LOG_LOCAL0)
                logger.writeLog(syslog.LOG_ERR, "%s"%(str(log)))
        except ConfigParser.NoOptionError:
            if (self.loadAttempt >= self.maxLoadAttempts):
                log = "Error loading Config File for HeaderOptions config, USING DEFAULTS"
                logger = log2syslog(self.milterName, syslog.LOG_LOCAL0)
                logger.writeLog(syslog.LOG_ERR, "%s"%(str(log)))
            else:
                self.loadError = True
                log = "Error loading Config File for HeaderOptions config, should try again"
                logger = log2syslog(self.milterName, syslog.LOG_LOCAL0)
                logger.writeLog(syslog.LOG_ERR, "%s"%(str(log)))