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.
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.
> 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
Does your person dataset contain all of the people you are interested in, and do they all have a displayname ?
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.
@Santt0sh - please share on mid tier from which log we can extract the ECM users login information.
Thanks,
Kaushal Solanki
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.