Configuring Logging for SAS Web Report Studio

Overview of Logging for SAS Web Report Studio

Beginning with the second maintenance release for 4.31, SAS Web Report Studio uses log4j to perform logging. The SAS Web Infrastructure Platform contains a framework for providing separate logging contexts for the individual SAS Web applications. Web application servers have a property defined on their command line (com.sas.log.config.url) that points to the directory where the log4j configuration files are located.
The SASWebReportStudio-log4j.xml configuration file is located in the SAS-configuration-directory \Levn\Web\Common\LogConfig directory. After the log4j configuration file is read, SAS Web Report Studio checks for modifications that were set with the SAS Web Administration Console.
A log can be set at five different levels of detail: DEBUG, INFO, WARN, ERROR, and FATAL. The default for the logging contexts is set to WARN, which means that only WARN, ERROR, and FATAL messages are recorded. In large-scale deployments, the size of the log file can grow rapidly when INFO messages are enabled. However, you might want to enable INFO messages during development and testing phases.
Every logging context can have outputs associated with it. As a result, different log messages might go to different locations. By default, all SAS Web Report Studio log messages go to both the application server console and the log file.
SAS Web Report Studio records events in two log files. By default, both log files are created in the SAS-configuration-directory \Lev\n\Web\Logs directory.
The following table summarizes the log files:
Log Files
Log Context and Default Filename
Description
configuration file
(SASWebReportStudio.log)
Logs events such as serious errors, application restarts, and users logging on. If you deploy multiple versions of SAS Web Report studio, each deployed application will have its own log configuration file with a filename that indicates the deployed application.
Key User Action Log
(SASWebReportStudio4.3_KeyActions.log)
Logs events such as application use, failed attempts to log on, report access, and batch report activities. For a list of all events, see Understand Key User Action Log Output.
Note: There are similar log files for SAS Web Report Viewer in the directory.
For more information about logging as it applies to SAS applications, see the SAS Intelligence Platform: Middle-Tier Administration Guide. For information about the log4j configuration file, see http://logging.apache.org/log4j/index.html and http://logging.apache.org/log4j/1.2/manual.html.

Configure Debug Logging Dynamically

The SAS Web Administration Console provides information about the SAS Web applications that are installed and configured at your site. This application is used for viewing application information from any machine with a Web browser, without the need to have SAS Management Console installed on the machine.
You can use the SAS Web Administration Console to configure logging for SAS Web Report Studio. For more information about the SAS Web Administration Console, see SAS Intelligence Platform: Middle-Tier Administration Guide.

Manage the Key User Action Log File

For the Key User Action Log, SAS uses a rollover mechanism to manage the size and age of the log. SAS periodically archives the current log and creates a new one. To archive a log, SAS saves the log with a new name that includes the current date and time. SAS archives the current log based on configurable settings related to the size of the file and the duration since the last archive. SAS can also delete files after the number of archived files reaches a particular limit.
The following table shows the default values for rollover properties.
Rollover Properties and Default Values
Rollover Properties
Default Values
sas.wrs.keyUserActionLog.rollover.max
-1
sas.wrs.keyUserActionLog.rollover.sizeKBytes
4000
sas.wrs.keyUserActionLog.rollover.ageHours
24
To manage the Key User Action Log and modify the values for rollover properties, follow these steps:
  1. In SAS Management Console on the Plug-ins tab, navigate to Application Managementthen selectConfiguration Managerthen selectSAS Application Infrastructurethen selectWeb Report Studio 4.3 and right-click to display the Web Report Studio 4.3 Properties.
  2. Select the Advanced tab.
  3. Click Add to display the Define New Property.
  4. Enter the property name and property value and click OK in the Define New Property :
    Property Name: sas.wrs.keyUserActionLog.rollover.max
    Property Value: Max Rollovers
    Property Name: sas.wrs.keyUserActionLog.rollover.sizeKBytes
    Property Value: Threshold Size for Rollovers
    Property Name: sas.wrs.keyUserActionLog.rollover.ageHours
    Property Value: Threshold Age for Rollovers
  5. Click Add in the Web Report Studio 4.3 Properties.
  6. Click OK to exit the Web Report Studio 4.3 Properties.
  7. To enable these properties to take effect, restart your Web application server.
If you are using SAS Web Report Viewer to render reports, then make similar changes for SAS Web Report Viewer. Periodically move or delete outdated archived log files.

Understand Key User Action Log Output

Events are logged to the WebReportStudio4.3_KeyActions.log file in an XML format. Each event has a numeric code value that uniquely identifies the event.
Beginning with SAS Web Report Studio 4.3 and later, an event is logged in the WebReportStudio4.3_KeyActions.log file when a user creates, edits, or deletes a distribution list. In order to perform these tasks, the user must belong to the Advanced Role with the Manage Distribution List capability for SAS Web Report Studio. For information about SAS Web Report Studio Roles, Predefined Roles .
The following table lists the events and their respective codes.
Log Events and Their Codes
Event
Code
User logged on.
0
User attempted to log on but failed.
1
User logged off.
2
User saved a report.
3
User opened a report.
4
User deleted a report.
5
User moved a report.
6
User copied a report.
7
User renamed a report.
8
System start.
9
User scheduled a report. If the user scheduled a folder of reports, then the log file lists the folder.
10
User distributed a scheduled report.
11
User created, edited, or deleted a distribution list.
12
Here are some entries from a sample log file for SAS Web Report Studio 4.3:
<wrskeyuseractions>
<event><javaDate>1124136823696</javaDate><date>5/15/10</date><time>4:13PM</
time><code>9</code><description>System
Startup</description></event> 
<event><javaDate>1124136826633</javaDate><date>5/15/10</date><time>4:13PM/
</time><user>sastrust@saspw</user><session>1</session>
<sasSession>a70abab74efe542e:-526869f2:1279155b649:-7f92 </sasSession>
<code>0</code><description>Logon</description></event>
<event><javaDate>1124136992808</javaDate><date>5/15/10</date><time>4:15PM/
</time><user>dolson</user><session>2</session>
<sasSession>a70abab74efe542e:-526869f2:1279155b649:-7f55<sasSession>
<code>0</code> <description>Logon</description></event>
<event><javaDate>1124136923432</javaDate><date>5/15/10</date><time>4:16PM/
</time><user>dolson</user><session>2</session>
<code>4</code><description>Open</description>
<report>/ReportStudio/Shared/Reports/Deanna/Bursting/Orion 2 level bygroup -3
</report></event> 
<event><javaDate>1124136977261</javaDate><date>5/15/10</date><time>4:17PM/
</time><user>dolson</user><session>2</session>
<code>3</code><description>Save</description>
<report>/ReportStudio/Shared/Reports/Deanna/Bursting/testReport</report></event>
<event><javaDate>1124136992808</javaDate><date>5/15/10</date><time>4:18PM/
</time><user>dolson</user><session>2</session><code>2</code>
<description>Logoff</description></event></event>
<event><javaDate>1124136826633</javaDate><date>5/15/10</date><time>4:19PM/
</time><user>sastrust@saspw</user><session>1</session>
<code>2</code><description>Logoff</description></event>
</wrskeyuseractions>

View Details of Users' Sessions in the Key User Action File

Beginning with SAS Web Report Studio 4.3, the WebReportStudio4.3_KeyActions.log file enables you to obtain useful details about SAS Web Report Studio users' sessions.
Here are some key features of the unique session number assigned to events associated with users' tasks:
  • For all events associated with a user's tasks (for example, logging on to SAS Web Report Studio, opening a report, saving a report, logging off from SAS Web Report Studio), the session number remains the same.
  • The number generated for the user's sessions is short, and it remains as a unique number until a system start-up occurs.
  • The session number is accompanied by a code value that indicates the type of task being performed by the user. For example, a code value of 2 for a session indicates that the user logged off from SAS Web Report Studio. This code is also interpreted and displayed in plain text within the description field.
  • For a logon session, the session number is accompanied by a sasSession number whose value corresponds with the session ID number that is listed in the SASWebReportStudio4.3.log file.
The sasSession number is a globally unique and lengthy string that is associated only with a code value of 0. A code value of 0 indicates a logon session by a user. When a key event is listed in the WebReportStudio4.3_KeyActions.log file with a session number and a unique string for sasSession, you can correlate this key event with the sasSession ID number listed in the SASWebReportStudio4.3.log file.
In this example from the WebReportStudio4.3_KeyActions.log file, the session for the user has a value of 3 that uniquely identifies this user's session. The code value of 0 and the description indicate that this is a logon session. Because this is a logon session, the sasSession element is listed with the globally unique string that correlates with the session ID number listed in the standard log.
<event><javaDate>1124136992808</javaDate><date>5/15/10</date><time>4:16PM/
</time><user>dolson</user><session>3</session>
<sasSession>a70abab74efe542e:-526869f2:1279155b649:-7f55<sasSession>
<code>0</code> <description>Logon</description></event>
In this example, the same user opens a SAS Web Report Studio report. This user's session value of 3 indicates that this is the same user whose logon session was identified with a value of 3 earlier. Here, the code value of 4 and the description indicate that the user opened a report.
<event><javaDate>1124136923432</javaDate><date>5/15/10</date><time>4:17PM/
</time><user>dolson</user><session>3</session>
<code>4</code><description>Open</description>
<report>/ReportStudio/Shared/Reports/Deanna/Bursting/Orion 2 level bygroup -3
</report></event> 
In this example, the user logs off from SAS Web Report Studio. The code value of 2 and the description indicate that logoff occurred for this user whose sessions were associated with the value of 3.
<event><javaDate>1124136992808</javaDate><date>5/15/10</date><time>5:00PM/
</time><user>dolson</user><session>3</session>
<code>2</code> <description>Logoff</description></event>

Report Events in the Key User Action Log

The information in the Key User Action Log can be imported into SAS data sets and presented in reports. To report the data, follow these steps:
  1. Import the WebReportStudio4.3_KeyActions.log data into a SAS data set. Here are the main steps:
    1. Assign a libref to an XML file that contains log data, and specify the XML engine.
      In the following example, MyFile.xml is a copy of a Key User Action Log file:
      libname myxml xml 'C:\My Files\XML\MyFile.xml';
    2. Use the SAS data sets procedure to import the XML file into a SAS data set.
      Here is an example:
      proc data sets library=myxml;
      This code creates a data set named EVENT in the MYXML library.
  2. In SAS Information Map Studio, create an information map based on the data set that you created in the preceding step. For the information map, you might want to provide the ability to filter based on the event code (<code> tag), the user name (<user> tag), the report name (<report> tag), or the date (<date> tag). For information about using SAS Information Map Studio, the product Help.
  3. In SAS Web Report Studio, define a report based on the information map that you created in the previous step. You can define the report to be refreshed manually, and then schedule the report to run at regular intervals.

Redirect Key User Action Files to a Different Directory

By default, the Key User Action log files are saved in the SAS-configuration-directory \Lev1\Web\Logs directory. However, you can specify a different directory where the Key User Action log files can be saved.
To specify a different directory where Key User Action log files can be saved, follow these steps:
  1. In SAS Management Console on the Plug-ins tab, navigate to Application Managementthen selectSAS Application Infrastructurethen selectConfiguration Managerthen selectWeb Report Studio 4.3 and right-click to display the Web Report Studio 4.3 Properties.
  2. Click the Advanced Tab.
  3. Click Add to display the Define New Property.
  4. Enter the property name as shown and specify the property value:
    Property Name: sas.wrs.keyUserActionLog.path
    Property Value: Fully Qualified Directory Path
  5. Click OK to exit the Define New Property.
  6. Click Add in the Web Report Studio 4.3 Properties.
  7. Click OK to exit the Web Report Studio 4.3 Properties.
  8. To enable the property to take effect, restart your Web application server.