Logging for SAS Servers

Logging Specific Types of Messages

SAS Environment Manager monitors SAS server log files and creates events for all error messages found in the log. The types of servers supported by this function are:
  • SAS Metadata Server
  • OLAP server
  • Object spawner
  • Stored process server
  • CONNECT spawner
  • Workspace server
  • Pooled workspace server
You can change the configuration to look for specific types of log entries other than errors. The entry type that you specify will then produce an event in SAS Environment Manager. To configure logging to track specific messages, follow these steps:
  1. Edit the file <server_config_directory>/sev_logtracker_plugin.properties (for example, /opt/SAS//Lev1/SASApp/OLAPServer/ sev_logtracker_plugin.properties)
  2. Add a line for the message that you want to track. The format is
    level.[level_of_message].[sequential_number]=[regular_expression]
    For example, this entry looks for an INFO message containing the phrase “AUTOEXEC processing beginning”:
    level.info.1=.*AUTOEXEC processing beginning.*
    .
  3. If you add multiple expressions to look for of the same log level, simply increment the number:
    level.info.2=.*Message text here.*
  4. Save the file. SAS Environment Manager will automatically use the revised file.

Setting Up Logging for SAS Servers

SAS Environment Manager can create events based on log monitoring for SAS servers such as SAS Metadata Server, SAS Object Spawner, and SAS OLAP Server. However, you must first specify a FixedFilename logfile in the logconfig.xml or logconfig.apm.xml file. To set up log monitoring for SAS servers, perform these tasks:
  • Create a fixed name logfile appender. See Time-Based Appender Example for a rolling file appender with a time-based policy. See Fixed Window Size Appender Example for a rolling file appender with a fixed window policy based on log size.
  • Add the appender to the logconfig.xml file for the server, or to the logconfig.apm.xml file if you are using the Audit, Measurement, and Performance package.
  • In the Server Configuration page in SAS Environment Manager, enable logging and specify the logconfig.xml or logconfig.apm.xml file in the server.log_track.files field.
  • Update the root logger to refer to the new appender

Time-Based Appender Example

This appender creates a fixed filename “HQ_<SAS_servername>.log” as a fixed name and rolls each day to an HQ_<SAS_servername>_Date_Hostname.log.
<appender class="RollingFileAppender" name="FixedFilename_Appender">
   <param name="File" value="/opt/sasinside/SASConfig/metadata/Lev1/SASMeta/MetadataServer/Logs/HQ_MetadataServer.log"/>
   <param name="Append" value="true"/>
   <param name="Unique" value="false"/>
   <param name="ImmediateFlush" value="true"/>
   <rollingPolicy class="TimeBasedRollingPolicy">
       <param name="FileNamePattern" value="/opt/sasinside/SASConfig/metadata/Lev1
/SASMeta/MetadataServer/Logs/HQ_MetadataServer_%d_%S{hostname}.log"/>
   </rollingPolicy>
   <layout>
       <param name="HeaderPattern" value="Host: '%S{hostname}', OS: '%S{os_family}', Release: '%S{os_release}', SAS Version: '%S{sup_ver_long2}', 
Command: '%S{startup_cmd}'"/>
       <param name="ConversionPattern" value="%d %-5p [%t] %X{Client.ID}:%u - %m"/>
   </layout>
</appender>
This code updates the root logger to refer to the new appender.
<root>
   <level value="Error"/>
   <appender-ref ref="TimeBasedRollingFile"/>
   <appender-ref ref="FixedFilename_Appender"/>    <<<<<<<<<<<<<<<<  Add this line 
   <appender-ref ref="IOMServer"/>
</root>

Fixed Window Size Appender Example

This appender creates a fixed filename “HQ_<servername>_hostname_1.log” as a fixed name and rolls to a second HQ_<servername>_hostname_2.log. When the second file reaches a size of 100MB, it is deleted and HQ_<servername>_hostname_1 is renamed to HQ_<servername>_hostname_2, re-creating _1.
<appender class="RollingFileAppender" name="RFA">
    <param name="ImmediateFlush" value="true"/>
    <param name="Append" value="true"/>
    <filter class=”LevelMatchFilter”>
           <param name=”LevelToMatch” value=”INFO”/>
           <param name=”AcceptOnMatch” value=”TRUE”/>
    </filter>
    <rollingPolicy class="FixedWindowRollingPolicy">
           <param name="fileNamePattern" value="/opt/sasinside/SASConfig/metadata/Lev1
/SASMeta/MetadataServer/Logs/HQ_MetadataServer_%S{hostname}_%i.log"/>
           <param name="minIndex" value="1"/>
           <param name="maxIndex" value="2"/>
    </rollingPolicy>
    <triggeringPolicy class="SizeBasedTriggeringPolicy">
           <param name="MaxFileSize" value="100MB"/>
    </triggeringPolicy>
    <layout>
           <param name="HeaderPattern" value="Host: '%S{hostname}', OS: '%S{os_family}', Release: '%S{os_release}', SAS Version: '%S{sup_ver_long2}', 
Command: '%S{startup_cmd}'"/>
           <param name="ConversionPattern" value="%d %-5p [%t] %X{Client.ID}:%u - %m"/>
    </layout>
</appender>
This code updates the root logger to refer to the new appender.
<root>
   <level value="Error"/>
   <appender-ref ref="TimeBasedRollingFile"/>
   <appender-ref ref="IOMServer"/> 
   <appender-ref ref="RFA"/>                     <<<<<<<<<<< add this line
</root>