Logging server statistics with binary logging

The binary logging feature allows server information to be stored in binary files. These files can then be processed to analyze the server information that has been gathered over time.

About this task

The following information is stored in the binary log for each server defined in the configuration.
  • cluster address
  • port number
  • serverID
  • server address
  • server weight
  • server total connections
  • server active connections
  • server port load
  • server system load

Some of this information is retrieved from the executor as part of the manager cycle. Therefore the manager must be running in order for the information to be logged to the binary logs.

A sample Java program and command file have been provided in the install_root/servers/samples/BinaryLog directory. This sample shows how to retrieve all the information from the log files and print it to the screen. It can be customized to do any type of analysis you want with the data. An example using the supplied script and program to get a report of the Load Balancer's server information from 8:00 AM to 5:00 PM on May 1, 2001:
dslogreport 2001/05/01 8:00 2001/05/01 17:00
Tip: You can use similar steps for configuring binary logging for the CBR component. Binary logging is not available for the Site selector component.

Procedure

Use dscontrol binlog command set to configure binary logging
  • Start binary logging:
    dscontrol binlog start
    The start option starts logging server information to binary logs in the logs directory. One log is created at the start of every hour with the date and time as the name of the file.
  • Stop binary logging:
    dscontrol binlog stop
    The stop option stops logging server information to the binary logs. The log service is stopped by default.
  • Set the interval value to control how often information is written to the logs.
    dscontrol binlog set interval seconds

    The manager will send server information to the log server every manager interval. The information is written to the logs only if the specified log interval seconds have elapsed since the last record was written to the log. By default, the log interval is set to 60 seconds. There is some interaction between the settings of the manger interval and the log interval. Since the log server is provided with information no faster than manager interval seconds setting the log interval less than the manager interval effectively sets it to the same as the manager interval.

    This logging technique allows you to capture server information at any granularity. You can capture all changes to server information that are seen by the manager for calculating server weights. However, this amount of information is probably not required to analyze server usage and trends. Logging server information every 60 seconds gives you snapshots of server information over time. Setting the log interval very low can generate huge amounts of data.

  • Set the retention option to control how long log files are kept.
    dscontrol binlog set retention hours
    Log files older than the retention hours specified are deleted by the log server. This will only occur if the log server is being called by the manager, so stopping the manager will cause old log files not to be deleted.
  • View the current status for binary logging:
    dscontrol binlog status
    The status option returns the current settings of the log service. These settings are whether the service is started, what the interval is, and what the retention hours are.