Archiving CDR Reporter Tool and custom SQL Queries.

There is an interesting and quite useful tool called Archiving CDR Reporter tool that comes with OCS 2007 resource kit.

The Microsoft Office Communications Server Archiving CDR Reporter tool can be used to collect variety of usage reports based on the information available in Archiving/CDR tables. Administrators can add custom queries to the configuration file and use them to look at various reports.

Here i am posting some information which covers how to configure the tool and how to write custom queries. It includes some useful custom queries which comes handy while troubleshooting the OCS Archiving cases.

1. Overview

Microsoft Office Communications Server 2007 Archiving and CDR Server provides a solution for archiving instant messaging (IM) conversations and group conferences and for capturing usage information related to file transfers, audio/video (A/V) conversations, application sharing, remote assistance, meetings, and conferencing servers in call detail records.

Note: Call detail recording (CDR) captures usage data for conferences. It does not archive the content of audio, video, or file transfers.

Messages from the Office Communications Server Front End Server are sent through the Windows Server Message Queuing service to the Archiving and CDR Server, which uses a Microsoft SQL Server database to store archived information.

The Microsoft Office Communications Server ArchivingCdrReporter tool that comes with resource kit can be used to collect variety of usage information from Archiving/CDR tables. Administrators can add custom queries to the configuration file i.e. ArchivingCdrReporter_Config.xml file and look at various usage reports.

Snapshot of Archiving CDR Reporter tool.

2. Configuration of Archiving CDR Reporter

After the installation of OCS Resource kit tools we get two files under ArchivingCdrReporter folder. One is the actual reporting tool (ArchivingCdrReporter.exe) and another one is the configuration file (ArchivingCdrReporter_Config.xml).

Before using this tool for the first time, we need to edit the Server/Instance name and the Database name in the configuration file or in the GUI of the reporting tool. This tool uses this configuration to connect to Archiving database to query and report usage information.

Method 1: Configuring from ArchivingCdrReporter_Config.xml

1. Configure the Archiving Backend Server/Instance name by editing the <servername></servername> parameter in ArchivingCdrReporter_Config.xml file.

Example:

<servername>archbackend</servername>

or

<servername>archbackend/archInst</servername>

2. Configure the Archiving Backend Database name by editing the <dbname></dbname> parameter in ArchivingCdrReporter_Config.xml file.

Example . <dbname>LcsLog</dbname>

Method 2: Configuring from ArchivingCdrReporter.exe

Double click on the ArchivingCdrReporter.exe and click on Backend Details on the top menu.

You will be prompted to enter Backend Server\Instance and Database details.

Enter the Backend Server\Instance and Database details and click on OK. By clicking OK the configuration is automatically saved to ArchivingCdrReporter_Config.xml.

  1. How to write custom SQL queries

The tool has a configuration file named ArchivingCdrReporter_Config.xml, which can be edited to add custom queries. We can add custom queries to the configuration file and use them to monitor variety of custom usage information.

If you want to add custom queries to be reported by the tool, edit the configuration file ArchivingCdrReporter_Config.xml and add a new query node under <Queries> </Queries> node.

Example. <Query>

<Name>Total number of Users</Name>

<Value>SELECT count(*) as 'Number of Users’</Value>

</Query>

  1. Some useful SQL queries

You can append the below section the ArchivingCdrReporter_Config.xml configuration file and view more useful reports.

Note: Replace the highlighted names / words as per your requirement.

<Queries>

<Name>More reports</Name>

<Query>

<Name>All IMs containing specific word</Name>

<Value>Select * from Messages where Messages.Body like '%Hello%'</Value>

</Query>

<Query>

<Name>All IMs Sent by User</Name>

<Value>Select * from Messages, Users where Users.UserId = Messages.FromId and Users.UserUri = 'mike@nwtraders.com'</Value>

</Query>

<Query>

<Name>All IMs Received by User</Name>

<Value>Select * from Messages, Users where Users.UserId = Messages.ToId and Users.UserUri = 'mike@nwtraders.com'</Value>

</Query>

<Query>

<Name>All IMs exchanged between Sender and Receiver</Name>

<Value>Select MessageIdTime, Body, u1.UserUri as [From], u2.UserUri as [To] from Messages, Users u1, Users u2 where Messages.FromId = u1.UserId and Messages.ToId = u2.UserId and u1.UserUri = 'mike@nwtraders.com' and u2.UserUri = 'john@nwtraders.com' union all Select MessageIdTime, Body, u2.UserUri, u1.UserUri from Messages, Users u1, Users u2 where Messages.FromId = u2.UserId and Messages.ToId = u1.UserId and u2.UserUri = 'john@nwtraders.com' and u1.UserUri = 'mike@nwtraders.com'</Value>

</Query>

<Query>

<Name>All IMs Sent between certain time range</Name>

<Value>Select * from Messages where MessageIdTime between '2008-04-02 1:50' and '2008-04-02 2:00'</Value>

</Query>

<Query>

<Name>All IMs Sent by a user within time range</Name>

<Value>Select * from Messages, Users where Users.UserId = Messages.FromId and Users.UserUri = 'mike@nwtraders.com' and Messages.MessageIdTime between '2008-04-02 1:50' and '2008-04-02 2:00'</Value>

</Query>

<Query>

<Name>All IMs Received by a user within time range</Name>

<Value>Select * from Messages, Users where Users.UserId = Messages.ToId and Users.UserUri = 'mike@nwtraders.com' and Messages.MessageIdTime between '2008-04-02 1:50' and '2008-04-02 2:00'</Value>

</Query>

</Queries>

</config>

For More Archiving SQL Queries please check this link below.

Different SQL Queries to Retrieve Archived Messages