Hello All, I'm having issue to get log parser values of all log files( for Object Spawner logs) for all end users like SAS EG & AMO. And I'm interested in 6 months or old SAS EG & AMO end users data. Currently, A byte-order mark in the file "C:\Users\akhan\Desktop\akhan\ObjectSpawner_2021-10-05_abc_host.log" (for fileref "#LN00008") indicates that the data is encoded in "utf-8". This encoding will be used to process the file. I just got values from this log ObjectSpawner_2021-10-05_abc_host.log file only. There are 10 more log files but the pointer only point to 1 log file. Please advise Attached is the SAS code. Thank you in advance Thanks, Asif
Edit by KB, to make the code readable without download:
%macro read_spawnlog;
data spawnlog;
*infile mylib truncover;
infile "C:\Users\akhan\Desktop\akhan\*.log" lrecl=100000000 dsd;
/*filename pth "&libpath";
%put &libpath;*/
format
datum ddmmyyp10.
zeit time8.
user $512.
port $512.
address $512.
success $1.
;
input
zeile $1024.
;
if index(zeile,"New client connection") > 0;
%if "&sysver" = "9.4"
%then %do;
datum = input(substr(zeile,1,10),yymmdd10.);
zeit = input(substr(zeile,12,8),time8.);
%end;
%else %if "&sysver" = "9.2"
%then %do;
datum = input(substr(zeile,1,10),yymmdd10.);
zeit = input(substr(zeile,12,8),time8.);
%end;
%else %if "&sysver" = "9.1"
%then %do;
datum = input(substr(zeile,1,8),yymmdd8.);
zeit = input(substr(zeile,10,8),time8.);
%end;
%else %do;
abort abend 7;
%end;
pos = index(zeile,"server port");
port = substr(zeile,pos+12,4);
pos = index(zeile,"for user");
if pos ne 0
then do;
user = substr(zeile,pos+9,5);
pos = indexc(user,".");
if pos ne 0 then user = substr(user,1,pos-1);
end;
/*else do;
pos = index(zeile,"server port");
port = substr(zeile,pos+12,5);
pos = index(zeile,"for user");
if pos ne 0
then do;
user = substr(zeile,pos+9,5);
pos = indexc(user,".");
if pos ne 0 then user = substr(user,1,pos-1);
end; */
else do;
pos = index(zeile,"for SAS token user");
user = substr(zeile,pos+19);
pos = indexc(user,"@");
if pos ne 0 then user = substr(user,1,pos-1);
end;
pos = index(zeile,"port are");
%if "&sysver" = "9.4"
%then %do;
address = substr(zeile,pos+17,15);
pos = indexc(address,"]");
if pos > 0 then address = substr(address,1,pos-1);
/*pos = index(APPNAME,"APPNAME");
APPNAME = substr(zeile,pos+283,140);*/
*pos = index(zeile,"904500");
*if pos > 0 then APPNAME = substr(APPNAME,1,pos-1);
*Details = substr(zeile,pos+250);
*pos = indexc(Details,".");
*APPNAME2 = substr(APPNAME,20,23);
*APPNAME2 = index(APPNAME,"SAS Enterprise Guide");
*APPNAME3 = substr(APPNAME2,pos+20);
*APPNAME2 = scan(Details,3);
*APPNAME3 = scan(Details,4);
*APPNAME4 = scan(Details,5);
*SAS_APPLICATION_Names = catx(' ',APPNAME2,APPNAME3,APPNAME4);
*if pos > 0 then Details = substr(Details,1,pos-1);
*where Details contains 'SAS Enterprise Guide';
*APPNAME2 = index(APPNAME,pos+20);
*APPNAME2 = substr(APPNAME,pos+22);
*pos = indexc(APPNAME2,".");
*if pos > 0 then APPNAME = substr(APPNAME,1,pos-1);
%end;
%else %if "&sysver" = "9.2"
%then %do;
address = substr(zeile,pos+17,15);
pos = indexc(address,"]");
if pos > 0 then address = substr(address,1,pos-1);
%end;
%else %do;
address = substr(zeile,pos+9,15);
pos = indexc(address,":");
if pos > 0 then address = substr(address,1,pos-1);
/*%end;
%else %do;*/
/*SASAPP = substr(zeile,pos+9,15);
pos = indexc(SASAPP,":");
if pos > 0 then address = substr(SASAPP,1,pos-1);*/
%end;
if index(zeile,"rejected") > 0 then success = "N"; else success = "Y";
drop pos;
run;
%mend;
%read_spawnlog;
data work.EGClients(drop=zeile);
set work.Spawnlog;
where zeile contains 'SAS Enterprise Guide';
run;
data work.ADDIn (drop=zeile);
set work.Spawnlog;
where zeile contains 'SAS Add-In for Microsoft Office';
run;
title1 "Enterprise Guide End Users Names List";
proc print data=work.EGClients;
run;
title1 "SAS Add-In End Users Names List";
proc print data=work.ADDIn;
run;
... View more