SAS Data Integration Studio, DataFlux Data Management Studio, SAS/ACCESS, SAS Data Loader for Hadoop and others

LSF generated logs having errors and warnings need to capture

Reply
Contributor SYN
Contributor
Posts: 39

LSF generated logs having errors and warnings need to capture

I would like to explain the background.

Example1 -  LSF(Platfrom process manger)  flow having 5 jobs. Once the flow started and executed fine. all 5 jobs went fine. All 5 job logs are stored in unix server location.

Example2 -  LSF(Platfrom process manger)  flow having 5 jobs. Once the flow started and executed. 3 jobs went fine and 1 job got ERROR and 1 job got WARNINGS. All 5 job logs are stored in unix server location.

My requirement

I have to take every log once appear in UNIX server location. I have to open the log file and check the log file.

If any  ERROR or  WARNINGS in log file. I have to capture this log details and write it in one notepad.

I have to write a macro to happen this. Please any suggetions. Thanks in advance.


Super User
Posts: 5,254

Re: LSF generated logs having errors and warnings need to capture

Been awhile since I worked with LSF, but I guess that it keep log files of flow and job return codes, right?

A nice application would be to have a stored process, that lets you chose between flows (with their RC), and then job within a flow (with their RC), and then link to the actual log.

Data never sleeps
Respected Advisor
Posts: 3,886

Re: LSF generated logs having errors and warnings need to capture

LSF has a rich set of commanes. BHIST for example lets you query with what return code jobs finished execution. Here the command reference http://support.sas.com/rnd/scalability/platform/PSS6.1/lsf7.06_command_ref.pdf

the second part would then be to parse the logs which ended with an error or warning. You could do this by either writing a SAS program or with some UNIX scripting.

I would bet that if you search the Internet a bit you will find a script which only needs some amendments.

N/A
Posts: 1

Re: LSF generated logs having errors and warnings need to capture

Looks to me you want the log messages of the sas jobs and not the LSF log.

This might just do what you wanted.

It captures all the existing logs of sas jobs submitted by LSF (including lsf flowname) and creates a dataset sasuser.errors with the jobname logdate and error lines

You'll have to change things for unix yourself

Hope this helps

      
    %let SASplatform = d:\SASPLF\;
    %let OTAPLevel   = lev1;
    %let SERVER      = ETL;
    %let LogDir      = BatchServer\logs\;
 
/*********************************************************************
   * Get the names of the logfiles              
   *********************************************************************/
    filename dirlist pipe "dir &SASplatform.GNL&server.\&otaplevel.\SAS&server.\&logdir.*.log";
       
    data sasuser.logfiles(keep=lognaam);
         length tekst $200 lognaam $120 process $100;
         infile dirlist truncover;
         input tekst $char200.;
         lognaam = "&SASplatform.SAS&server.\&otaplevel.\SAS&server.\&logdir"||scan(tekst,5,' ');
         if index(lognaam,'.log') then
         output;
    run;

  /***************************************************************
   * read the logfiles and extract the errors
   ***************************************************************/
       
   data sasuser.errors(keep=process logdatum line);
     set sasuser.logfiles;
  length line $200;
     format datetime datetime 21.2;
     process  = scan(scan(lognaam,1,'200'),8,"\");
  process  = substr(process,1,length(process)-1);
     logdatum = scan(lognaam,-2,'_');
     infile dummy missover truncover end=end length=len filevar=lognaam;
     retain process;
     do until(end);
        input line $200.;
        line = left(line);
        if index(upcase(line),'ERROR:')= 1 then
           do;
*           starttime = input(scan(line,10,' '),?? time8.);
*           startdate = input(scan(line,2,','),date12.);
*           start  = dhms(startdatum,0,0,starttijd);
           output sasuser.errors;
           end;
     end; /* end of do until step */
   run;

Ask a Question
Discussion stats
  • 3 replies
  • 690 views
  • 0 likes
  • 4 in conversation