BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Santt0sh
Lapis Lazuli | Level 10

Hi All,

 

I am trying to read SAS ECM log file in order to capture the login and logoff time.

I was successful to read the SAS ECM log file using a sas data step.

But I am not sure why I am not able to capture all the events from the log file into SAS dataset. Only the members of a certain group are captured in the dataset.

 

I am using the below code to read the log file and process it further.

 

/* Determine list of files to analyze */
 %let start_dt=01JAN2018;

 /* %let log_path=/tmp/logs_workarea/xxxServer8_1;*/
 /* %let log_path=/workspace/wfeaa/sasdata/xxx/logs/;*/
 %let log_path=/workspace/wfeaa/sasdata/xxx/logs/midtier_replica;
 filename flist pipe "ls &log_path.";

 data step01(keep=fpath);
  length fname $255;
  infile flist;
  input fname $;
  last_word=input(scan(fname,-1,'.'),yymmdd10.);
  fpath="&log_path./"||fname;

  if last_word= '.' or last_word ge "&start_dt."d then
   output;
 run;

 /* Get relevant records from log files */
 data _null_;
  set step01;
  call execute
   ("
   filename logrecs pipe 'more "||fpath||" | grep com.sas.solutions.casemgmt.util.AppSessionContext';
   data step02;
   length instr $1000;
   infile logrecs lrecl=1000 dlm='7F'x missover truncover dsd;
   input instr $;
   if find(instr,'INFO') then output;
    run;
   proc append base=step03 data=step02;
   run;");
 run;

 proc sql;
  create table step04 as
   select instr, name, displayname
    from step03
     left join person on instr contains displayname
      having displayname ne '';
 quit;

 /* Analyze log files */
 DATA WORK.INPUT_L (DROP=  instr DT dt1);
  set step04;

  IF (FIND(instr, '- Creating session context for user,')) GE 1 THEN
   DO;
    DT=Substr(instr,21,16);
    Login_tme=input(DT,anydtdtm23.);
    FORMAT Login_tme DateTime23.;
   END;

  IF (FIND(instr, 'Clearing session context for user')) GE 1 THEN
   DO;
    DT1=Substr(instr,21,16);
    LogOff_tme=input(DT1,anydtdtm23.);
    Format LogOff_tme DateTime23.;
   END;
 RUN;

 

Please help me on this. I am not able to read all the users who have logged in to SAS ECM.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Santt0sh
Lapis Lazuli | Level 10

Hi,

 

Thank you for your reply,

I have managed to get the log in details of the Users.

The code which i had posted above works fine, there was a small mistake while copying the log files from Mid-tier to the Compute - tier.

we were using the Dev Host name  on SIT environment.

 

 

Thank you for all the suggestions.

 

View solution in original post

4 REPLIES 4
ChrisNZ
Tourmaline | Level 20

> Only the members of a certain group are captured in the dataset.

 

It's hard to reply without seeing the data, but my first thought is that only the members of this group match your logic.

 

A comment: The PAD option on the INFILE statement is often useful

 

34reqrwe
Quartz | Level 8

Does your person dataset contain  all of the people you are interested in, and do they all have a displayname ? 

 

Santt0sh
Lapis Lazuli | Level 10

Hi,

 

Thank you for your reply,

I have managed to get the log in details of the Users.

The code which i had posted above works fine, there was a small mistake while copying the log files from Mid-tier to the Compute - tier.

we were using the Dev Host name  on SIT environment.

 

 

Thank you for all the suggestions.

 

kaushalsolanki
Quartz | Level 8

@Santt0sh  - please share on mid tier from which log we can extract the ECM users login information.

 

Thanks,

Kaushal Solanki

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 2215 views
  • 0 likes
  • 4 in conversation