Community discussion is present here: http://community.pbspro.org/t/pp-838-support-for-logging-via-syslog-in-pbs/591
Table of Contents |
---|
...
Overview
PBS currently has a facility for logging via syslog. We are reverse engineering to the EDD. We need to have the use cases, test scenarios and test cases (both manual and PTL) reviewed by the open source community.
Use Cases
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
The design for adding syslog matching is been written so that there minimal changes for existing functionality.
1) The same sysloglog_match() function will be used. It will have an attribute for syslog. If this attribute is not set, PTL will check the pbs.conf file for syslog setting.
...
3) Multihost support is provided. syslog messages from individual hosts will be read.
Things to be taken intoo into consideration-
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.
...
A new class syslog_utils is added for reading the date, syslog file path and the logic for which log messages file to check.
Wiki page for syslog. This can be referred to for understanding basics of syslog
———————syslog_utils.py——————
...
facility = //PBS_SYSLOG from pbs.conf
serverity = // PBS_SYSLOGSEVR from pbs.conf (by default NONE)
Methods:
def get_log_config_values(syslog=false)
...
2) Logic for whether to read local logs/ syslog we will follow this table -
Note: Return value is the value that will be by _log_match().
| |||||||||||||||||||||||||||||||||||||||||||||||||
|
Note:
...
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
Note: The error thrown will be PtlLogMatchError
Return:
self.file_to_check (/ / file_to_check =1 for syslog, file_to_check=2 for local logs and file_to_check=3 for both)
def get_log_syslog_lines(hostname, n, logval):
...
Description:
- get type of syslog utility (rsyslog/syslog-ng) running on host and syslog conf file. Currently we are only supporting rsyslog
- According to utility get list_of_priorites[] (severity + facility) - get_rsyslog_priorites(), def get_syslogng_priorites()
- With the priorities get list_of_syslog_files[] (if there is no list of files returned, throw PTL error) get_rsyslog_files(), get_syslogng_priorites()
- Get lines from each of the files in list_of_syslog_files[] - def get_syslog_lines()
If no lines are returned throw PTLerror - Combine and Sort lines by datetime
...
Input: severity and priority facilty values
return list_of_priorities[]
...
Input: severity and priority facilty values
return list_of_priorities[]
...
return list_of_files[]
def get_syslogsyslogng_ng_files(self, list_of_priorities[])
...
def get_syslog_lines(self, hostname=None, n=50, logval=None, filename=None):
Summary: Return the last block of lines from the syslog files for that particular daemon
...
# n= number of lines requested by user
# file namefilename: the file to read
...
syslog: If the user wants to read into syslog file? By default false
Execution steps Description:
1) run syslog_config.log_config_values(syslog=syslog) to check if local logs/ syslog is to be checked
...
// Read in local logs only if syslog log match is returned true. If syslog match fails there is no need to check in local logs logs since the test will be marked as a failure.
if syslog_return:
...
tm = self.convert_date_time(l[:date_length], syslog=syslog)
Test Scenarios
1) Test that when PBS_SYSLOG=1 is enabled in pbs.conf, PBS logs messages via syslog.
...
7) Test that server and sched and mom messages can be differentiated explicitly in the syslog log file.
8) Check that there is no performance issue with large log files
8) Test that logging via sys logging can be set for only a particular daemon.
(This functionality is not present in PBS)