Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Community discussion is present here: http://community.pbspro.org/t/pp-838-support-for-logging-via-syslog-in-pbs/591

...

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 communityhave to add support to PTL to test the syslog functionality of PBS.

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). 

...

For adding syslog support in PTL we will have to make changes in two files-  pbs_logutils.py and pbs_testlib.py. 

A new class pbs_syslog_utils is added for reading the date, syslog file path and the logic for which log messages file to check.


———————syslog———————pbs_syslog_utils.py——————

New Class:

class pbs_syslog_utils(object):

  facility = //PBS_SYSLOG from pbs.conf

  serverity = //  PBS_SYSLOGSEVR from pbs.conf (by default NONE)

Methods:

    def get_log_config_values(syslog=false)

...

      1) read from PBS.conf  - PBS_SYSLOG & PBS_LOCALLOG

       a) First check if the PBS_SYSLOG & PBS_LOCALLOG are set in the pbs.conf file
       b) If the values are not set in the pbs.conf file we will set variable PBS_SYSLOG=0 and PBS_LOCALLOG=1 (line 3 in below table), i.e PTL will execute log_match() in local logs.

      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() from the PBSService. Since _log_match() will only return one value of _log_match() we will use the below table to decide it.  

       This info has still been added to this table because the rest of the table is necessary to depict it. Consider it as extra information from the below table.

     


PBS_SYSLOG  

PBS_LOCALLOG  

Syslog_attribute 

Which log to check in log_match() 

Return Value for the log_match()

Not_set 

0 

false

Throw error


Not_set 

0 

true

Throw error Not_set 


1 

false

Local_Log 

local_log(x,y) 

Not_set 0

1 

true

Throw error 


set 

0 

false

Syslog 

syslog(x,y)

set 

0 

true

Syslog 

syslog(x,y)

set 

1 

false

Match in both logs 

local_log(x,y)

set 

1 

true

Syslog 

syslog(x,y)









 

...

      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)

...

  1.  get type of syslog utility (rsyslog/syslog-ng) running on host and syslog conf file. Currently we are only supporting rsyslog
  2. According to utility get list_of_priorites[] (severity + facility) - get_rsyslog_priorites(), def get_syslogng_priorites()
  3. With the priorities get list_of_syslog_files[]  (if there is no list of files returned, throw PTL error) get_rsyslog_files(), get_syslogng_prioritesfiles()
  4. Get lines from each of the files in list_of_syslog_files[] - def get_syslog_lines()
    If no lines are returned throw PTLerror
  5. Combine and Sort lines by datetime

...

      Description:

      1) run pbs_syslog_configutils.get_log_config_values(syslog=syslog) to check if local logs/ syslog is to be checked

...

    The syslog value is further passes to log_lines() and match_mshmsg()      

    lines = self.log_lines(syslog=true)

...

           logval = self._instance_to_logpath(logtype)

           lines = self.syslogUtils.pbs_syslog_utils.get_log_syslog_lines(hostname=self.hostname, n=n, logval=logval)

...