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

...

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

New added functions to read from syslog will be added to the existing class PBSLogUtils()

———————In pbs_logutils.py——————

Class PBSLogUtils(object):

  facility = //PBS_SYSLOG from pbs.conf

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

Methods:

    def _get_log_type()

       Summary: logic for which messages to read (local logs / syslog)

      Description: 

      1) read from PBS.conf  - PBS_SYSLOG & PBS_LOCALLOG.

   

      2) Logic for whether to read local logs/ syslog we will follow this table -

           

...

PBS_SYSLOG  

PBS_LOCALLOG  

Which log to check in log_match() 

0 

Throw error

1

Local_log

set (1-7)

0

Syslog 

set (1-7)

1 

 Match in both logs 

unsetunsetLocal_log

       Note: In row 4 where we have to match in both syslog and local log, we would have to call _log_match() twice. 

       Note: In case of row 4 the return value for log_match() will return lines from local_logs only.

       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)

    

   

New methods:       

    def _get_syslog_lines(hostname, n, logval):

...

class PBSService(PBSObject)

   New method 

  def _get_log_type()

       Summary: logic for which messages to read (local logs / syslog)

      Description: 

      1) read from PBS.conf  - PBS_SYSLOG & PBS_LOCALLOG.  

      2) Logic for whether to read local logs/ syslog we will follow this table -

           

     


PBS_SYSLOG  

PBS_LOCALLOG  

Which log to check in log_match() 

0 

Throw error

1

Local_log

set (1-7)

0

Syslog 

set (1-7)

1 

 Match in both logs 

unsetunsetLocal_log






       Note: In row 4 where we have to match in both syslog and local log, we would have to call _log_match() twice. 

       Note: In case of row 4 the return value for log_match() will return lines from local_logs only.

       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 log_match()

      Description:

        1)  PBSLogUtilsself._get_log_type() to check if local logs/ syslog is to be checked

          x= PBSLogUtils._get_log_type(syslog=syslog)

       2) if x =1 or 3 -  read _log_match(syslog=true)

...