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

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

...

  1.  get type of syslog utility (rsyslog/syslog-ng) running on host and syslog conf file. Currently we are only supporting rsyslog and not syslog-ng
  2. get PBS_SYSLOGSEVR from pbs.conf. If it is not set throw error PBSConfigError that set PBS_SYSLOGSEVR
  3. According to utility get list_of_priorites[] (severity + facility) - get_rsyslog_priorites()
  4. With the priorities get list_of_syslog_files[]  (if there is no list of files returned, throw PTL error) get_rsyslog_files()
  5. Get lines from each of the files in list_of_syslog_files[] - def get_syslog_lines(). This will consider the n and logval arguments. Only the specified logval messages will be considered
    If no lines are returned throw PTLerror
  6. Combine and Sort lines by datetime

...

        return list_of_files[]

    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

        Input:

        #hostname = host from which to read syslog file

        # n= number of lines requested by user

        # filename: the file to read       

        # logval - sched/server/mom/comm logs 

        return lines[]



Changes to existing methods are made in the following files:- 

...

        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() to check if local logs/ syslog is to be checked

          x= PBSSyslogUtils.get_log_type()

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

...

           lines = self.PBSSyslogUtils.get_log_syslog_lines(hostname=self.hostname, n=n, logval=logval)

...