Skip to content

Instantly share code, notes, and snippets.

@frayos
Created February 20, 2018 15:07
Show Gist options
  • Select an option

  • Save frayos/b22704b4bc093c77eac3d60ff93b9174 to your computer and use it in GitHub Desktop.

Select an option

Save frayos/b22704b4bc093c77eac3d60ff93b9174 to your computer and use it in GitHub Desktop.
SAS EVM clean
1. Folder D:\SASConfigFolder\Lev2\Web\SASEnvironmentManager\emi-framework\apm\Data\artifacts
** artifactusagedetails ***
You can exclude information for the technical user from the datasets in the APM data mart. E.g. to exclude information for the technical user in dataset artifactusagedetails.sas7bdat following steps could be used.
1. Make a backup of file "logusagecombine.sas" located in <configdir>/Lev1/Web/SASEnvironmentManager/emi-framework/apm/SASEnvironment/SASMacro
2. Open file "logusagecombine.sas"
3. Search for section
%addtzoffvar(datetime=datetime, hostvar=hostname, outvar=tzoneoff, form=DATASTEP);
%addshiftvar(datetime=datetime, offsetvar=tzoneoff, outvar=shift, shiftfmt=shifttxt, prefixvar=hostname, form=DATASTEP);
run;
and change it to
%addtzoffvar(datetime=datetime, hostvar=hostname, outvar=tzoneoff, form=DATASTEP);
%addshiftvar(datetime=datetime, offsetvar=tzoneoff, outvar=shift, shiftfmt=shifttxt, prefixvar=hostname, form=DATASTEP);
/* Code added by <name> on <date> to exclude technical user information from APM dataset artifactUsageDetails */
if user = "<username>" then delete;
/*end */
run;
4. Run master_APM_etl.sh
5. Check dataset artifactUsageDetails. Information for user <username> should not have been added.
*** audit_transactions ***
1. How to exclude information for user from the dataset audit_transactions in the APM data mart.
1.1. Make a backup of file "logauditsave.sas" located in <configdir>/Lev1/Web/SASEnvironmentManager/emi-framework/apm/SASEnvironment/SASMacro
1.2. Open file "logauditsave.sas"
1.3. Search for section
%logUtilTableExist(WORK.AUDIT_TRANSALL);
%if &tableExists. %then %do;
proc append data=&loglib..audit_transAll base=&auditlib..audit_transactions;
run;
%end;
and change it to
%logUtilTableExist(WORK.AUDIT_TRANSALL);
%if &tableExists. %then %do;
/* Code added by <name> on <date> to compress APM dataset artifactUsageDetails */
data &loglib..audit_transAll;
set &loglib..audit_transAll;
if A_ActiveUserid in("<username>") then delete;
run;
/*end */
proc append data=&loglib..audit_transAll base=&auditlib..audit_transactions;
run;
%end;
NOTE : if existing records needs to be deleted in table audit_transactions add
/* Code added by <name> on <date> to compress APM dataset artifactUsageDetails */
data &auditlib..audit_transactions;
set &auditlib..audit_transactions;
if A_ActiveUserid in("<username>") then delete;
run;
/*end */
1.4. Run master_APM_etl.sh
1.5. Check dataset audit_transactions. Information for user <username> should not have been added.
FYI:
It is possible to keep only information in the APM datamart for a certain time frame e.g. only the last month. You can do this by
* Logon to SAS Management Console
* Application Management --> Configuration Manager
* RMB "EnvMgr Enablement Kit 2.1". Choose "Properties"
* Go to "Data Mart ETL Setting"
Here you can set
- ACM Number of Days of Raw Records
- Number of Days of Resource Records in the Data Mart
- Number of Days of Audit Records to Retain in the Data Mart
These changes will take place next time the ETL is run.
2. Folder D:\SASConfigFolder\Lev2\Web\SASEnvironmentManager\emi-framework\Archive
This folder contains an archive of all APM logs that were processed by the master_apm_etl process. This process is populating the data in the APM data mart located at D:\SASConfigFolder\Lev2\Web\SASEnvironmentManager\emi-framework\apm\Data . Once the apm logs are processed they are zipped and put in folder D:\SASConfigFolder\Lev2\Web\SASEnvironmentManager\emi-framework\Archive . You can move these .zip to another location or delete them based on a timestamp.
3. Folder D:\SASConfigFolder\Lev2\Web\SASEnvironmentManager\emi-framework\Datamart\kits
*** emi_info ***
By default info is append to this dataset. Instead of appending information to the dataset you also can replace it using below steps :
1. Make a backup of file runEMIProcessLogs.sas located at <configdir>/Lev1/Web/SASEnvironmentManager/emi-framework/SASJobs
2. Open the file and change line
%logparse_sasev_events(outds=kits.emi-events,dir=&sasevconfigdir./Events/,
namematchrx=%str(.*.events));
to
/* Code changed by <name> on <date> to replace file emi_info */
%logparse_sasev_events(outds=kits.emi-events,dir=&sasevconfigdir./Events/,
namematchrx=%str(.*.events),append=NO);
3. During the next etl run the emi_info dataset should be replaced with only the latest information.
4. Folder D:\SASConfigFolder\Lev2\Web\SASEnvironmentManager\emi-framework\LandingZone\apm
Information in the LandingZone is normally deleted once it is processed by the etl processes. There are two exceptions. One is when the etl processes are run manually. The other is when the etl process didn't run successfully. If there are any subfolders that are older then today you should be able to safely remove them.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment