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

...

  facility = //PBS_SYSLOG from pbs.conf

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

Methods:

    def get_log_type(syslog=false)

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

...

       b) If PBS_SYSLOG is not set, we will locally in code set variable PBS_SYSLOG=0

       c) If  PBS_LOCALLOG is not set, we will locally in code set variable PBS_LOCALLOG=1

      Therefore this will check into the local logs only if values are not set (see line 3 in below table)


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

0 

false

Throw error


0 

true

Throw error 


1 

false

Local_Log 

local_log(x,y) 

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

        Summary: This function returns the syslog messages for logmatch

        Input:

        #hostname = host from which to read syslog file

        # n= number of lines requested by user  

        # logval - sched/server/mom/comm logs 

...

       syslog: If the user wants to read into syslog file? By default false

     

      Description:

        1) if attribute syslog = true, enable syslog parameter in pbs.conf and disable PBS_LOCALOG. Set x = 1.Skip step 2 and go to step 3 below.

       2) if syslog = false run PBSSyslogUtils.get_log_type(syslog=syslog) to check if local logs/ syslog is to be checked

          x= syslog_config. PBSSyslogUtils.get_log_config_values(syslog=truetype()

      2) If only syslog messages are to be checked -  3) if x =1 or 3 -  return _log_match(syslog=true)

      3) If only local log messages are to be checked - return _log_match(syslog=false)

     4) If both syslog and local log messages are to be checked -     

          syslog_return = _log_match(syslog=true) 

          // 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 since the test will be marked as a failure.

          if syslog_return:   

             return 4) if x = 2 or 3 -  return _log_match(syslog=false)

          else:            return syslog_return

     

  def _log_match(syslog=False)

...