Accessibility

TechNote (Archived)

Macromedia Flash Communication Server Logging

Introduction
When administrating Macromedia Flash Communication Server MX, it is very important to be able to gather statistical information about the various applications, and application instances running on the server. In most server environments, server logs are an important tool for both managing and troubleshooting the server. This is especially true of servers that handle communications traffic that can use a lot of bandwidth. The architecture of the Flash Communication Server is such that there can be many different applications and application instances running at the same time and it is important to be able to keep track of how many users are connecting to the server and how much bandwidth is being used by each application or application instance. The Server Management ActionScript API is quite flexible and can be used to gather a lot of this information. Below are descriptions of some of the various logging methods and some sample logging applications that have been built with the Server Management ActionScript API. These applications can be used as is, can be tailored to suit the specific needs of a server administrator, and provide a good example of the kinds of administration applications that can be built with the Server Management ActionScript API.

Logging Methods
Flash Communication Server Log Reader
Flash Communication Server Bandwidth Monitor (Flogger)

Logging Methods

Server access log
The server can save access data in a stream called "access.flv". This is controlled by the<RecordAccessLog> entry in the Vhost.xml configuration file. If this is set to true, the server stores access information in a stream called "access.flv" that is located in the application folder admin/streams/logs subdirectory.

Application trace() log
Server-side ActionScript files may use the trace() command to record information in a server log. This is controlled by the <RecordAppLog> entry in the Application.xml file. If this is set to true, the server stores the messages from the trace() statements in a file in the admin/streams/logs/application/YourAppName/ directory. The file will be given the application instance name.
Server Script Logging
The server admin application is a special server application that allows control and access to information about the server. A server-side script may access this data and save it to a stream for later retrieval.

Retrieving logging information
Regardless of how the logging information is stored on the server, it must be retrieved, analyzed and formatted into logging reports to be of any use. Typically, a special client movie (SWF) is used to access the server, download the log data, and create reports.

Sample logging programs
There are two sample logging programs available. The first one is the Flash Communication Server Log Reader. This client program connects to the server as an admin user, downloads the server access log or application trace logs, and creates reports in HTML for display in a web browser. The second one is the Flash Communication Server Bandwidth Monitor (Flogger). The Flash Logger program has two main components: a server side script that records server data such as bandwidth, and a client program that can access this information and create log reports.

Flash Communication Server Log Reader
This program is a Flash application that reads access and application logs from the Flash Communications Server. It allows an administrator to generate reports of server usage, and can be used as a starting point for customized server logging. Users of this program should be familiar with how to install, configure and administer the Flash Communications Server.

The Flash Communication Server Log Reader consists of several components which you can download:
FlashLogPlayer client movie: the Flash movie used to read server data and generate reports (FlashLogPlayer.swf, 53 KB).
FlashLogPlayer source code: the .fla source file for the client movie(FlashLogPlayer.fla, 498 KB).
FlashLogPlayer web page: a HTML page hosting the client Flash movie(FlashLogPlayer.html, 5 KB).
Server admin.asc script: a server-side ActionScript program for backing up server access logs(admin.asc, 5 KB).

Download
Flash Communication Server Log Reader components for Windows:flashcom_log_player.zip (199k)
Flash Communication Server Log Reader components for Macintosh:flashcom_log_player.sea.hqx (289k)

Background: Server log streams
The Flash Communications Server writes two types of logs:
Access log: this file contains information on when users logged on and off the server. The data is stored in the Flash Communications Server FlashCom\applications\admin\streams\logs\access.flv file.
Application logs: these files contain the output of trace() statements from server-side ActionScript programs. The text displayed for each application instance is stored in a different log file. These files are located in the FlashCom\applications\admin\streams\logs\application\<AppName> folder.
Both types of log files may be examined by the FlashCom Log Player program.

Installing the Log Player program
The FlashLogPlayer web page (FlashLogPlayer.html) and movie (FlashLogPlayer.swf) should be copied to the same folder on your computer, or installed on a web server. The FlashLogPlayer movie must be accessed through a web browser. If the SWF is run through the Flash stand-alone player, it will not generate reports correctly.

Configuring the Server to save access logs
The Flash Communication Server by default will not save access information. To change this, edit the Vhost.xml configuration file and change the <RecordAccessLog> tag to have a "true" value. The server must be restarted for this to take affect. With this option enabled, the server writes access records to the FlashCom\applications\admin\streams\logs folder in the access.flv file.

Configuring the Server to backup access logs
The access logs saved by the Flash Communications Server can grow to be quite large, especially on an active server. To keep the data down to a manageable size, and help reduce report generation times, a script can be installed on the server to backup and reset the logs daily.

This script will read the access.flv file at midnight, make a copy of the contents in the FlashCom\applications\admin\streams\logs\application\admin folder, and clear the existing access file. Each saved file will be named something like "Access_2002-06-12.flv" indicating the date the file was saved.

To install this program, copy the "admin.asc" file into your server's applications\admin folder. If you already have a main script for the server's admin program (main.js, main.asc, admin.js or admin.asc in the same folder) you must merge the two programs. To merge them, you should:
1 Rename the admin.asc program to some other name, such as "LogRotation.asc".
2 Copy the renamed file into the server's applications\admin folder.
3 Edit the existing admin program file and add a command at the top to load the new script:
load("LogRotation.asc" );
4 Edit the existing admin program file's application.onAppStart() routine to call:
setupLogRotationInterval();
5 Save the admin program file, and restart the server.

Running the Log Player Program
Producing a server log consists of several steps:
1 Log on the server as an admin user
2 Read a log from the server
3 Generate a report from the log data

To log on the server:
1 Open the FlashLogPlayer.html web page in a browser.
2 Enter the server address. You will be logging in as an administrator, so include the admin port (1111 by default) to the server address. It may look like"server.company.com:1111" or "localhost:1111".
3 Enter a valid administrator user ID and password in the appropriate fields.
4 Press the "Connect" button.
5 The application will jump to the main screen once properly connected. If you can't connect, double-check the server address, administrator port, user ID and password.

To read a log from the server:
1 Enter the log name. For the current access log, it will be just "access". For an archived access log, it will be something like"application/admin/Access_2002-05-26_13". For an application log, it will be similar to "myApp/_definst_".
2 Select the type of log, access or application, using the radio buttons to the right of the log file name.
3 Choose "Read Log".
4 The movie will read the log from the server. The status windows will contain messages indicating progress or any errors. If reading a log properly, wait until it has finished before trying to generate a report.

To Generate a Report:
The create the default report, just press the "Create Report" button. The program will generate and open a web page with the server information. You may, however, alter the report in several ways:
1 The "Show Details" check box will add a list of individual data points for an access report. The report will contain every client logon in the access log.
2 The list box with application names allows selecting individual applications for the access report. This will only limit the individual client logons to a particular application.
3 The "Start Time" and "Stop Time" selections allow limiting the report to a specific time interval.
4 The "Max Entries" allow limiting the report to a specific number of entries, preventing the report from becoming too large.

Summary
The FlashCom Log Player application retrieves application and access logs from the Flash Communication Server MX. The program generates basic reports of server activity. The application may be extended and customized by users for their individual requirements.
Return to top

Flash Communication Server Bandwidth Monitor (Flogger)
This program is a Flash application that saves bandwidth usage information from the Flash Communications Server. It allows an administrator to generate reports of server usage, and can be used as a starting point for customized server logging. Users of this program should be familiar with how to install, configure and administer the Flash Communications Server.

The Flogger Bandwidth Monitor consists of several components that are available for download:
Flogger client movie: the Flash movie used to read server data and generate reports(Flogger.swf, 49 KB).
Flogger source code: the FLA source file for the client movie (Flogger.fla, 460 KB).
Flogger web page: a HTML page hosting the client Flash movie (Flogger.html, 5 KB).
Server Flogger.asc script: a server-side ActionScript program for saving bandwidth information(Flogger.asc, 13 KB).
Application.xml: a server configuration file for loading the Flogger server application(Application.xml, 1 KB).

Download
Flash Communication Server Bandwidth Monitor for Windows: flogger.zip (169k)
Flash Communication Server Bandwidth Monitor for Macintosh:flogger.sea.hqx (251k)

Background: how the Flogger system works
The Flogger system has several components that all work together: a server application that saves bandwidth information, and a client Flash movie (SWF) that reads the bandwidth data and generates reports.

The Flogger.asc file is the script for a server-side application. This program is loaded when the server starts, and logs onto the same server as an administrator user. The program then regularly polls the server to determine what applications are running, the server overall bandwidth usage, and individual application bandwidth usage. This data is saved every minute into a stream (FLV file) on the server.

The Flogger client movie is used to read this archived bandwidth information and create reports. It may be run from the server machine or another remote computer. This Flash movie connects to the server under the Flogger application, reads the saved data from the stream (FLV file) and analyses it. The user may select several options for the report, and the program will generate a web page (HTML file) containing summary and detailed information about the server bandwidth usage.

Installing the Flogger client program
The Flogger web page (Flogger.html) and movie (Flogger.swf) should be copied to the same folder on your computer, or installed on a web server. The Flogger movie must be accessed through a web browser. If Flogger.swf is run through the Flash stand-alone player, it will not generate reports correctly.

Since the Flogger client program is not used by regular end-users, it should not be installed in a publicly available web page. It can be either stored locally on computers used by administrators, or located in a secure section of a web site, available only with password access.

Installing the Flogger server program
The Flogger program is installed like any other server-side application. A new folder named "Flogger" should be created in the Flash Communication Server application directory, and the Flogger.asc and Application.xml files copied into it.

For the Flogger server program to work, two items should be altered in the Flogger.asc script file. Both changes are made in the application.onAppStart() function at the top of the script:
1 For the line that reads:
application.userList["CLIENT"] = "Logger";
Change the "CLIENT" string to be the desired user name forclients that can connect and generate reports. Change the"Logger" string to be this user's password. If desired, additional user ID and passwords may be added to the same array to allow multiple clients to generate reports.
2 For the lines that read:
application.adminInfo.adminID = "admin";
application.adminInfo.adminPassword ="adminPassword";
Change the adminID and adminPassword properties to be a valid server administrator ID and password. This is the logon information the program will use to connect to the server's administrator program to get bandwidth usage data.

To begin recording server bandwidth usage, either restart the Flash Communication Server or connect to the server with the Flogger client program. To confirm the client is working correctly, either connect using the Flogger client application, or use the normal server administration tools to examine the server's running applications.

The Application.xml file that is copied into the Flogger application folder does two things:
1 Sets the <LoadOnStartup> tag totrue so the Flogger server-side program is loaded whenever the server starts.
2 Sets the <MaxAppIdleTime> time to a large value to prevent the server from automatically unloading the Flogger application when there are no clients connected to it.

Server bandwidth log files
If the application is properly installed and the server correctly configured, the Flogger application should create a stream file located in the<application folder>\Flogger\streams\_definst_\ folder. These files will be named something like "BandwidthInfo_2002_06_20.flv" with the actual date determining the file name.

The server Flogger program will automatically create a new bandwidth log file at midnight each day. Each file contains the bandwidth usage for 24 hours. Starting and stopping the server should not have any effect on these files.

Running the Flogger program
Producing a server bandwidth log consists of three steps:
1 Log on the server using the Flogger client movie and web page
2 Read a log from the server
3 Generate a report from the log data

To log on the server:
1 Open the Flogger.html web page in a browser.
2 Enter the server address. You must enter the same user ID and password that are recorded in the Flogger.asc server-side ActionScript file.
3 Choose"Connect".
4 The application will jump to the main screen once properly connected. If you can't connect, double-check the server address, user ID and password.

To read a log from the server:
1 Enter the log name. It should look like "BandwidthInfo_2002_06_20", with the proper year, month and date entered. Month and date values are filled with leading zeros, so the log for the first day of April would be"BandwidthInfo_2003_04_01".
2 Choose "Read Log".
3 The movie will read the log from the server. The status windows will contain messages indicating progress or any errors. If reading a log, wait until it has finished before trying to generate a report.

To Generate a Report:
The create the default report, just press the "Create Report" button. The program will generate and open a web page with the server information. You may, however, alter the report in several ways:
The "Show Hourly Summary" check box will add a data table that shows bandwidth usage by the hour.
The "Show Server Details by Minute" check box will add a data table that shows the server's bandwidth usage for every minute. This option can make the report, and the time needed to generate it, quite large.
The "Show Application Details by Minute" check box will add a data table that shows an application's bandwidth usage for every minute. This option can make the report, and the time needed to generate it, quite large.
The list box with application names allows selecting individual applications reports. This will limit the report to the selected application's information only.
The "Start Time" and "Stop Time" selections allow limiting the report to a specific time interval.
The "Max Entries" allow limiting the report to a specific number of entries, preventing the report from becoming too large.

Summary
The Flogger package is designed to save, read and report on bandwidth usage of the Flash Communication Server MX. The program generates basic reports of server bandwidth capacity and CPU usage. The application may be extended and customized by users for their individual requirements.



AlertThis content requires Flash

To view this content, JavaScript must be enabled, and you need the latest version of the Adobe Flash Player.

Download the free Flash Player now!

Get Adobe Flash Player

Creative Commons License

Search Support


Document Details

ID:tn_16464
Browser:Chrome
Internet Explorer
Netscape
Opera
Safari
Firefox
Database:DB2
Informix
MySQL
Oracle
SQL Server
Sybase
MS Access

Products Affected: