Community discussion is present here: http://community.pbspro.org/t/pp-838-support-for-logging-via-syslog-in-pbs/591
...
In row 7 where we have to match in both syslog and local log, we would have to call _log_match() twice.
Note: Currently we are only supporting for the current syslog file and not for previous days file. That would be covered in PP-969
import platform
class syslog_utils(object):
...
# PBS supported severity and facilities
p_severity = ['info', 'debug']
p_facility = ['*', 'local7', ....]
facility = //PBS_SYSLOG from pbs.conf
serverity = // PBS_SYSLOGSEVR from pbs.conf (by default NONE)
def log_config_values(syslog=0)
...
// returns a integer value which is interpreted as which file to check
file self.file_to_check=0
// read from PBS.conf PBS_SYSLOG & PBS_LOCALLOG
// Logic of which file to read log messages from- syslog / or local
// file_to_check =1 for syslog, file_to_check=2 for local , logs and file_to_check=3 for both
return filereturn self.file_to_check
def log_syslog_lines(self):
...
list_of_priorities = self.get_rsyslog_priorites(severity=severity, facility=facility)
self.list_of_syslog_files = self.get_rsyslog_files(list_of_priorities)
...
list_of_priorities = self.get_syslogng_priorites()severity=severity, facility=facility)
self.list_of_syslog_files = self.get_syslogng_files(list_of_priorities)
...
# If facility and severity mentioned return the file for that combination from rsyslog.conf
# If severity and facility is NONE read into rsyslog.conf file and return all files priotities that contain the severity set in syslog-ngrsyslogd.conf
return list_of_priorities[]
def get_syslogng_priorites(self, severity=None, facility=None)
...
# If facility and severity mentioned return the file for that combination from rsyslog.conf
# If severity and facility is NONE read into rsyslog.conf file and return all files priotities that contain the severity set in syslog-ng.conf
return list_of_priorities[]
...
def get_rsyslog_files(self, list_of_priorities[])
# Returns the path of files to be read on basis of the priorities. Since the syslog messages can be stored in multiple files, a list is returned
# If facility and severity mentioned return the file for that combination from rsyslog.conf
# If severity and facility is NONE read into rsyslog.conf file and return all files that contain the severity set in rsyslogd.conf
return list_of_files[]
def get_syslog_return list_of_files[]
def get_syslog_ng_files(self, list_of_priorities[])
# # Returns the path of files to be read on basis of the priorities. Since the syslog messages can be stored in multiple files, a list is returned
# If facility and severity mentioned return the file for that combination from syslog-ng.conf
# If severity and facility is NONE read into rsyslog.conf file and return all files that contain the severity set in syslog-ng.conf
return list_of_files[]
...
def get_syslog_lines(self, hostname=None, n=50, filename=None, logval=None):
# Return sthe the last block of lines from the syslog files for that particular daemon
...
————pbs_testlib.py——————————
Following changes are done to the current log_match() function
1) Adding extra attribute 'syslog' to _log_match(syslog=False)
By default this attribute should be set to false
...
Following changes are done to the current log_match(syslog=false), init_logfile_path(syslog=False), def log_lines(syslog=False)log) function
1) log_match() calls the _log_match() method.
...
——————————In pbs_logutils.py—————————————
...
Class PBSLogUtils(object)
...