...
1. As an admin, I should be able to set PBS logging via syslog so that all daemons log into the same file.
2. As an admin, I should be able to control log events level of the PBS logging.
3. As an admin, I should be able to set the logging via syslog for all nodes in the cluster
4. As an admin, I should be able to set the logging via syslog for all servers in a failover environment.
5. As a admin I should be able to have logging into both local daemons and Syslog enabled together
6. As an admin/user, I should be able to run tracejob for a specific job with Syslog.
Note- This functionality is not currently given by PBS. This is added here because it is nice enhancement for future use.
7. As an admin/user, I should be able to differentiate log messages from each daemon.
8. As an admin/user, I should be able to set logging via syslog for only a particular daemon (Server, Mom, Sched or Comm).
Design
To add the functionality on which log to check, syslog or local logs we will follow this table -
| ||||||||||||||||||||||||||||||||||||||||
|
In row 7 where we have to match in both syslog and local log, we would have to call _log_match() twice.
For adding syslog support in PTL we will have to make changes in two files- log pbs_utilslogutils.py and pbs_testlib.py. We should make sure that the user running the tests will have permissions to read syslog file and decompress it. For eg - in test bed machine pbsroot shoud be able to read from syslog file.
Changes in pbs_logutils.py
1) Adding extra attribute 'readSyslog' to _log_match(readSyslog=False)
By default this attribute should be set to false
2) Adding extra attribute 'readSyslog' to log_match(readSyslog=False)
By default this attribute should be set to false
log_match() calls the _log_match() method.
Therefore according to the table above we should have a conditional statements in log_utils.pylog_match()
In case both have to be read we should call the _log_match() twice.
Changes in this file are related to the format of the recorded datetime and getting the path to the syslog file. Syslog records the datetime in a different format than local logs. According to the format we will have to do changes to reading the datetime.
Some syslog files are compressed. Even if we can derectly read a compressed file (eg .bz file) from python, but I would prefer if we decompress it so that rest of the code in PTL for reading files will work without any changes.
1) Check is file is compressed. Decompress location with same name. This will have to run everytime we want to do log_match().
if sys_log_file == compressed
decompress_file_to_text()
_sys_log_path_ = decompressed_file_path.Read file from Syslog config file
Currently we are only supporting for the current syslog file and not for previous days file. That would be covered in PP-969
2) Date format.
Change regular expression ‘tm_re ’ to match the date format of the syslog file.
...
def init_logfile_path
if PBS_SYSLOG=1 and Local_log =0
path_log_file = _sys_log_path_
elif elif locally
path_log_file= __local_path__
...
def log_lines
if PBS_SYSLOG=11
path_log_file = _sys_log_path_
...