Sun Java System Directory Server Enterprise Edition 6.0 Administration Guide

Configuring Directory Proxy Server Log Rotation

By default, log files are rotated when the log file size reaches 100 Mbytes. Ten log files are retained by default, after which the rotation procedure begins to overwrite the oldest log file. This section describes how to configure Directory Proxy Server logs for scheduled rotation, how to rotate logs manually, and how to disable log rotation. For example configurations, see Example Configurations for Log Rotation.

ProcedureTo Configure Periodic Rotation of Access and Error Logs

This procedure configures the Directory Proxy Server access log. To configure the Directory Proxy Server error log, perform the same procedure but replace access with error.

You can use DSCC to perform this task. For information, see Directory Service Control Center Interface and the DSCC online help.

  1. (Optional) View the properties of the access log.


    $ dpconf get-access-log-prop -h host -p port
    
  2. (Optional) View valid values for the properties of the access log.

    $ dpconf help-properties access-log
  3. To rotate logs when they reach a certain size, set the following properties:


    $ dpconf set-access-log-prop -h host -p port \
     log-rotation-policy:size log-rotation-size:maximum file size
    

    If the unit of the maximum file size is not specified, the default unit of bytes is used. When the log file reaches the defined size, the log is rotated. The file size must be at least 1 Mbyte and no more than 2 Gbytes.

    For an example of how to rotate logs by size, see Rotating the Log Based on Log Size.

  4. To rotate logs periodically, irrespective of the log size, set the following properties:


    $ dpconf set-access-log-prop -h host -p port \
     log-rotation-frequency:interval in months, weeks, hours, or minutes \
     log-rotation-policy:periodic \
     log-rotation-start-day:day in week (1-7) or day in the month (1-31) \
     log-rotation-start-time:time of day (hhmm)
    

    If the log is configured for rotation on the 31st of the month but the month has fewer than 31 days, the log is rotated on the first day of the following month.

    For examples of how to rotate logs periodically, see Rotating the Log Based on Time.

  5. To rotate logs periodically if the log file is big enough, set the log-rotation-frequency and log-min-size properties.


    $ dpconf set-access-log-prop -h host -p port \
     log-rotation-frequency:interval in months, weeks, hours, or minutes \
     log-rotation-policy:periodic log-min-size:minimum file size
     log-rotation-start-day:day in week (1-7) or day in the month (1-31) \
     log-rotation-start-time:time of day (hhmm)
    

    The log-min-size property represents the minimum size of the log. The rotation takes place at the scheduled time only if the log file is bigger than the specified size.

    If the log is configured for rotation on the 31st of the month but the month has fewer than 31 days, the log is rotated on the first day of the following month.

    For an example of how to rotate logs periodically if the file size is big enough, see Rotating the Log Based on Time and Log Size.

ProcedureTo Rotate Access and Error Logs Files Manually

This procedure rotates the Directory Proxy Server access log. To rotate the Directory Proxy Server error log, perform the same procedure but replace access with error.

You can use DSCC to perform this task. For information, see Directory Service Control Center Interface and the DSCC online help.

    Rotate the access log.


    $ dpconf rotate-log-now -h host -p port access

ProcedureTo Disable Access and Error Log Rotation

This procedure disables rotation of the Directory Proxy Server access log. To disable rotation of the Directory Proxy Server error log, perform the same procedure but replace access with error.

    Disable log file rotation.


    $ dpconf set-access-log-prop -h host -p port enable-log-rotation:false

Example Configurations for Log Rotation

Examples of how to configure log rotation by log size, time, or both follow.

Rotating the Log Based on Log Size

This section example shows how to configure a log rotation according to log size only. This configuration rotates the log when it reaches 10 Mbytes, irrespective of the time since the log was last rotated.


$ dpconf set-access-log-prop -h host1 -p 1389 log-rotation-policy:size \
  log-rotation-size:10M

Rotating the Log Based on Time

The examples in this section show how to configure log rotation according to the time since the last rotation, irrespective of log size.

If the log-rotation-start-day is set to 31 and the month has only 30 days, the log is rotated on the first day of the following month. If the log-rotation-start-day is set to 31 and the month has only 28 days (February), the log is rotated on the 3rd.

Rotating the Log Based on Time and Log Size

This example shows how to configure a log rotation for a specified interval if the file size is big enough.

This configuration rotates the log at 3:00, 11:00, and 19:00 every day, if the size of the log file exceeds 1 Mbyte. If the size of the log file does not exceed 1 Mbyte, the log file is not rotated.


$ dpconf set-access-log-prop -h host1 -p 1389 log-rotation-frequency:8h \
 log-rotation-policy:periodic log-min-size:1M log-rotation-start-time:0300