Refining WebPlayer Audit Logger to exclude logging certain operations.

Refining WebPlayer Audit Logger to exclude logging certain operations.

book

Article ID: KB0076285

calendar_today

Updated On:

Products Versions
Spotfire Web Player 7.0 and below

Description

The INFO/DEBUG level Web Player Audit logger writes message with respect to events such as “Login”, ”Logout”, ”View Library”, “Open Analysis”, “Close Analysis”, "Initiate Open Analysis", etc. This article explains suppressing a few of these events/operations being written to the log file or log database. This can be helpful where there is a need for writing only q few Audit log category messages.

Example.

The INFO level Audit logger writes messages related to events such as Login”, ”Logout”, “Open Analysis”, “Close Analysis”, "Initiate Open Analysis". If there is a requirement where only "Login" and "Logout" events needs to be logged, this article can be helpful. Similarly, some DEBUG level events can be suppressed as well.

Issue/Introduction

Refining Web Player Audit Logger to exclude logging certain operations for version 7.0 and below.

Resolution

This requirement can be implemented through log4net filter elements and using a combination of “StringMatchFilter”  and “DenyAllFilter”. The “StringMatchFilter” will write messages that have a matching String, and “DenyAllFilter” will deny all other unmatched messages. In other words, the messages which contain specific strings will be written and other unmatched messages will be suppressed. Go through the reference pages for more details on log4net filter element.

Example:
To suppress “Open Analysis”, “Close Analysis”, "Initiate Open Analysis" events in the Audit Log, the following modification can be applied. Here the assumption is that user has already enabled Audit logger in INFO/DEBUG level.

Modify log4net.config (located at "<WebPlayer Installation Directory>\webroot\app_data" folder for version 7.0 and below.

Search for the “<appender name="AuditLog" type="log4net.Appender.RollingFileAppender">………….…</appender>” section.

Find the <Layout> section.
Add the following lines between the </Layout> tag and the </appender> tag:

========  Lines to be added to log4net.config file  ===========

<filter type="log4net.Filter.StringMatchFilter">

   <stringToMatch value="Login"/>

</filter>

<filter type="log4net.Filter.StringMatchFilter">

   <stringToMatch value="Logout"/>

</filter>

<filter type="log4net.Filter.DenyAllFilter" />

==================================================

This code will allow only event messages containing the string "Login" and "Logout" to be logged and will deny all other unmatched messages.

Note:  The DenyAllFilter should be the last filter so that it will deny all other logs which are not matched in the above filters. This code applies to the situation where the user has already enabled Web Player Audit Logger in the INFO/DEBUG level. Also, switching to a different level will have no effect as long as the above filters are there. Similarly other messages can be allowed or suppressed in the INFO or DEBUG level Audit logger for TIBCO Spotfire WebPlayer 5.0,5.5,6.0,6.5. 

Additional Information

http://logging.apache.org/log4net/release/manual/configuration.html
http://www.beefycode.com/post/Log4Net-Tutorial-pt-7-Filters.aspx
http://www.codeproject.com/Articles/140911/log-net-Tutorial