Importing and Exporting Events

Overview

SAS Environment Manager provides services that enable you to import and export event data. Event importing provides a specified location and format for external applications or SAS code to write events to. When data is written to the specified location, SAS Environment Manager creates an event, which can then be handled just like any other event in the application. Event exporting operates in a similar manner. Every time an event occurs in SAS Environment Manager, the application creates an entry in a specified location, using a specified format. You can then configure third-party monitoring tools to monitor the location for new entries and handle the exported events.

Import Events

To import events, you must first create an event importer service.
  1. Select Resourcesthen selectBrowsethen selectPlatforms, and then select the platform on which you want to create the service.
  2. On the detail page for the selected platform, select Tools Menuthen selectNew Platform Service.
  3. On the New Service page, specify a name for the service and select SAS Event Importer in the Service Type field. Click OK to define the service.
  4. Select Resourcesthen selectBrowsethen selectServices, and then select the SAS Event Importer service that you just defined.
  5. The detail page for the service displays a message indicating that the service has not been configured. Click the Configuration Properties link.
  6. On the Configuration Properties page, select the importer.enable check box to turn on event importing. Also select the service.log_track.enable check box to enable log tracking. Specify the log file that you want to track in the service.log_track.files field. The file that you specify in this field is the log file that external SAS applications or programs write to. Specify a single log file in this field, and do not use wildcards in the filename. Click OK to save the configuration.
If you want a SAS program to create an event, add the EVEVENT macro. This macro creates an event in the proper format and stores it in a specified directory.
The format of an event that can be imported is as follows:
dateTtimeoffset|msglevel|source|message
The date is specified as yyyy-MM-dd.
The time is specified as HH:mm:ss.
The msglevel must be one of these values: ERROR, WARN, INFO, DEBUG.
Note: In order to use the EVEVENT macro, you must access the code for the macro. Use %INCLUDE statements to include the code for the %EVEVENT and %EVERRMSG macros in your program. The source code for the macros is located in the /emi-framework/SASMacro directory.
The syntax for the macro is as follows:
%macro evevent(src=source_message_string,msglevel=message_level
,msgtext=message_string);
src=
specifies the originator of the event. You can also use this parameter to specify the format of the text in the msgtext= parameter. The value that you specify for the format is specified by the parser. Use a colon (:) to separate the originator and the format information.
msglevel=
specifies the level of the event. Valid values are DEBUG, INFO, WARN, and ERROR.
msgtext=
specifies the text of the event message.

Exporting Events

To export events, you must create an event exporter service.
  1. Select Resourcesthen selectBrowsethen selectPlatforms, and then select the platform on which you want to create the service.
  2. On the detail page for the selected platform, select Tools Menuthen selectNew Platform Service.
  3. On the New Service page, specify a name for the service and select SAS Event Exporter in the Service Type field. Click OK to define the service.
  4. Select Resourcesthen selectBrowsethen selectServices, and then select the SAS Event Exporter service that you just defined
  5. The detail page for the service displays a message indicating that the service has not been configured. Click the Configuration Properties link.
  6. On the Configuration Properties page, select the exporter.enable check box to turn on event exporting. Click OK to save the configuration.
  7. Specify the user ID and password of a SAS Environment Manager user that is used to query events. The user ID that you specify must be a member of the Super User role and must also be defined in SAS metadata. You cannot specify the user IDs sasadm@saspw or sasadm, because these user IDs are specified differently in SAS metadata and SAS Environment Manager. The best practice is to use SAS Management Console to define a user in the form domain\newuserID, add that user to the user group SAS Environment Manager Super Users, and then synchronize the users in SAS Environment Manager. You can then specify the user ID newuserID in the event exporter service.
  8. In the exporter.filename field, specify the filename and location where event records are to be written. You need to point your third-party monitoring application to this location in order to read events as they are recorded. Click OK to save the configuration.
The format of an exported event is as follows:
dateTtimeoffset|msglevel|source|message
The date is specified as yyyy-MM-dd.
The time is specified as HH:mm:ss.
The msglevel must be one of these values: ERROR, WARN, INFO, DEBUG.
Here is an example of an exported event:
2014-08-06T14:59:20-0400|WARN|EMI Framework|emiInit ran with -f force option