Versions Compared

Key

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

...

class PBSService(PBSObject)


   def

...

   

   def log_match(syslog=True)

      if syslog:      

...

Note- 'def log_lines' returns the last n lines of the log file.

def  def log_lines(self, syslog=True)

    if syslog = 1

      filename  filename = syslog_utils.path_to_syslog()

  elif  elif locally

     filename = __local_path__

...

Class PBSLogUtils(object)

     syslog=0false


     def convert_date_time(fmtsyslog=false)

         if syslog = 1

             self.fmt fmt=    //get format from syslog_config.time_syslog()

           try:

            t  t = time.strptime(datetime, fmt)

             if syslog:   

               now = time.strftime("%Y,%m,%d,%H,%M,%S")
               split_now = now.split(',')

               t_edit = list(t)
               t_edit[0]= int(split_now[0])
               t = time.struct_time(tuple(t_edit))


     def match_msg(syslog=false)

         if syslog:           

            date_length = //length according to date format (by default set to 15)

       

        if lines:

            for l in lines:

               if starttime is not None:

                  tm = self.convert_date_time(l[:date_length], syslog_flag=syslog)

              if endtime is not None:

                 tm = self.convert_date_time(l[:date_length], syslog_flag=syslog)

           


Test Scenarios

1) Test that when PBS_SYSLOG=1 is enabled in pbs.conf, PBS logs messages via syslog.

...