13 Managing Logs

Oracle Traffic Director records data about server events such as configuration changes, instances being started and stopped, errors while processing requests, and so on in log files. You can use the logs to diagnose server problems, evaluate server usage patterns, and tune the system for improved performance.

This chapter contains the following sections:

About the Oracle Traffic Director Logs

Each Oracle Traffic Director instance, including the administration server, has two logs-an access log and a server log. You can enable access and server logs for each virtual server in the instance.

The default location of the access log and server log for an Oracle Traffic Director instance is the DOMAIN_HOME/servers/instance-name/logs directory.

In addition to the access and server logs, there are instance logs that are enabled by default and initialized when the instance is started for the first time.

This section provides an overview of the access and server logs. For information about changing log settings, including the name and location of log files, see Configuring Log Preferences.

Access Log

The access log contains information about requests to, and responses from, the server. The default name of the access log file is access.log.

The following example shows the first three lines in a typical access log:

format=%Ses->client.ip% - %Req->vars.auth-user% [%SYSDATE%] "%Req->reqpb.clf-request%" %Req->srvhdrs.clf-status% %Req->srvhdrs.content-length% %Req->vars.ecid%
10.177.243.207 - - [28/Aug/2011:23:28:30 -0700] "GET / HTTP/1.1" 200 4826 -
10.177.243.207 - - [28/Aug/2011:23:28:31 -0700] "GET / HTTP/1.1" 200 916 -

The first line indicates the access log format. The second and third lines are the actual entries.

You can change the access log format, file name, and location. You can also disable the access log. See Configuring Log Preferences.

Server Log

The server log contains data about lifecycle events—server start-up, shut down, and restart; configuration updates; and so on. It also contains errors and warnings that the server encountered. The default name of the server log file is server.log.

The following line is an example of an entry in a server log.

[2011-10-03T02:04:59.000-07:00] [net-soa] [NOTIFICATION] [OTD-10358] []
 [pid: 11722] http-listener-1: http://example.com:1904 ready to accept requests

The default server-log level is NOTIFICATION:1, at which only major lifecycle events, warnings, and errors are logged.

You can change the log level, the log file name, and the log file location. See Configuring Log Preferences.

Table 13-1 lists the log levels that you can specify for the server log.

Table 13-1 Server Log Levels

Log Level Description

INCIDENT_ERROR:1

A serious problem caused by unknown reasons. You should contact Oracle for support.

ERROR:1

ERROR:16

ERROR:32

A serious problem that requires your immediate attention.

WARNING:1

A potential problem that you should review.

NOTIFICATION:1 (default)

A major lifecycle event, such as a server being started or restarted.

TRACE:1

TRACE:16

TRACE:32

Trace or debug information to help you or Oracle Support diagnose problems with a particular subsystem.

The number following each log level indicates the severity of the logged event on the scale 1–32. An ERROR:1 message is of higher severity than an ERROR:16 message.

TRACE:32 is the most verbose log level and INCIDENT_ERROR:1 is the least verbose. Enabling the TRACE log levels might affect performance, because of the high volume of messages that are logged. Therefore, avoid enabling verbose log levels in production systems, except in situations when you need more detailed information to debug issues.

Viewing Logs

After creating logs for virtual servers, you can view the list of logs for each virtual server. To view a list of logs, run the displayLogs command.

You can view the access and server logs of Oracle Traffic Director instances and virtual servers by using either Fusion Middleware Control or the WLST.

Note:

  • Besides using WLST or Fusion Middleware Control, you can also use the standard operating-system commands such as ls and more to list and view the log files.

  • The Log Viewer in Fusion Middleware Control and the displayLogs CWLST command display only the log entries that currently exist in the access log file, TCP access log, and error log on the disk. They do not display items from the access-log buffer (see Configuring Access-Log Buffer Settings)).

Viewing Logs Using Fusion Middleware Control

View log data for a node, an instance, or virtual server within an instance by using the Fusion Middleware Control,

  1. Log in to Fusion Middleware Control, as described in Displaying Fusion Middleware Control.
  2. Click the WebLogic Domain button at the upper left corner of the page..
  3. Select Administration > OTD Configurations.

    A list of the available configurations is displayed.

  4. Select the configuration for which you want to view logs.
  5. Click the Traffic Director Configuration In the Common Tasks pane.
  6. Select Administration > Logging.
  7. The Oracle Traffic Director Log Viewer window is displayed.
  8. A list of the Server Log Preferences, Access Log Preference, and TCP Access Log Preferences Tabs are displayed.
    • To view the server log, select the Server Log Preference tab.

    • To view the access log, select the Access Log Preference tab.

    • To view the TCP access log, select the TCP Access Log Preference tab.

Viewing Logs Using WLST

To view the access log for an instance or a virtual server, run the displayLogs command.

For example, the following command displays the access-log records for the instance of the configuration foo.

displayLogs(target="sc:otd_foo_machine1") 

Configuring Log Preferences

When you create a configuration, the server and access logs are enabled with certain default settings. You can change the server log level, file name, and location. You can change the access log format, file name, and location. You can also disable the access log. If you change the location of the server log, you should restart the instance for the change to take effect.

The log preferences defined in a configuration are applicable to all the virtual servers in the configuration. At the virtual-server level, you can define the access-log location and format, and the server-log location.

You can configure log preferences for Oracle Traffic Director instances by using either Fusion Middleware Control or the WLST as described in the following topics:

Configuring Log Preferences Using Fusion Middleware Control

Configure log preferences for a configuration or a virtual server by using the Fusion Middleware Control

  1. Log in to Fusion Middleware Control, as described in Displaying Fusion Middleware Control.
  2. Click the WebLogic Domain button at the upper left corner of the page.
  3. Select Administration > OTD Configurations.

    A list of the available configurations is displayed.

  4. Select the configuration for which you want to configure log preferences.
  5. Click the Traffic Director Configuration In the Common Tasks pane.
  6. Select Administration > Logging.
  7. The Oracle Traffic Director Log Viewer window is displayed.
  8. A list of the Server Log Preferences, Access Log Preference, and TCP Access Log Preferences Tabs are displayed.
    • To view the server log, select the Server Log Preference tab.

    • To view the access log, select the Access Log Preference tab.

    • To view the TCP access log, select the TCP Access Log Preference tab.

  9. Specify the parameters that you want to change in the each Tab.

    On-screen help and prompts are provided for all of the parameters.

    For information about specifying a custom access-log format, see Using the Custom Access-Log Format in the Configuration File Reference for Oracle Traffic Director .

    When you change the value in a field or tab out of a text field that you changed, the Apply button near the upper right corner of the page is enabled.

    At any time, you can discard the changes by clicking the Revert button.

  10. After making the required changes, click Apply.

Configuring Log Preferences Using WLST

  • To view the current access-log preferences for a configuration or a virtual server, run the getConfigurationAccessLogProperties or otd_getVirtualServerAccessLogProperties commands.

    For example, the following command displays the access-log preferences for the configuration foo.

    props = {}
    props['configuration'] = 'foo'
    otd_getConfigurationAccessLogProperties(props)
    
    log-file=$DOMAIN_HOME/servers/$INSTANCE_NAME/logs/access.log
    format=%Ses->client.ip% - %Req->vars.auth-user% %SYSDATE% "%Req->reqpb.clf-request%" %Req->srvhdrs.clf-status% %Req->srvhdrs.content-length% %Req->vars.ecid% %Req->vars.origin-server%
    default-access-log-format=%Ses->client.ip% - %Req->vars.auth-user% %SYSDATE% "%Req->reqpb.clf-request%" %Req->srvhdrs.clf-status% %Req->srvhdrs.content-length% %Req->vars.ecid% %Req->vars.origin-server%
    
  • To set or change access-log preferences for a configuration or a virtual server, run the setConfigurationAccessLogProperties or otd_setVirtualServerAccessLogProperties commands.

    For example, the following command changes the location of the access log for the configuration foo to logs/access.log.

    props = {}
    props['configuration'] = 'foo'
    props['log-file'] = 'logs/access.log'
    otd_setConfigurationAccessLogProperties(props)
    

    For information about specifying a custom access-log format, see Using the Custom Access-Log Format in the Configuration File Reference for Oracle Traffic Director .

  • To disable the access log for a virtual server, run the otd_disableVirtualServerAccessLog command, as shown in the following example:

    props = {}
    props['configuration'] = 'foo'
    props['virtual-server'] = 'bar'
    otd_disableVirtualServerAccessLog(props)
    
  • To view the current server-log preferences for a configuration, run the otd_getLogProperties command.

    For example, the following command displays the server-log preferences for the configuration soa.

    props = {}
    props['configuration'] = 'foo'
    otd_getLogProperties(props)
    
    log-stdout=true
    log-stderr=true
    log-virtual-server-name=false
    create-console=false
    log-to-console=true
    log-to-syslog=false
    log-level=NOTIFICATION:1
    log-file=../logs/server.log
    
  • To set or change server-log preferences for a configuration, run the otd_setLogProperties command. Note that if you change the location of the server log, you should restart the instance for the change to take effect.

    For example, the following command changes the server-log level for the configuration foo to TRACE:32.

    props = {}
    props['configuration'] = 'foo'
    props['log-level'] = 'TRACE:32'
    otd_setLogProperties(props)
    
  • To view the current access-log preferences for a configuration or a virtual server, run the getConfigurationAccessLogProperties or otd_getVirtualServerAccessLogProperties commands.

    For example, the following command displays the access-log preferences for the configuration foo.

    props = {}
    props['configuration'] = 'foo'
    otd_getConfigurationAccessLogProperties(props)
    
    log-file=$DOMAIN_HOME/servers/$INSTANCE_NAME/logs/access.log
    format=%Ses->client.ip% - %Req->vars.auth-user% %SYSDATE% "%Req->reqpb.clf-request%" %Req->srvhdrs.clf-status% %Req->srvhdrs.content-length% %Req->vars.ecid% %Req->vars.origin-server%
    default-access-log-format=%Ses->client.ip% - %Req->vars.auth-user% %SYSDATE% "%Req->reqpb.clf-request%" %Req->srvhdrs.clf-status% %Req->srvhdrs.content-length% %Req->vars.ecid% %Req->vars.origin-server%
    
  • To set or change access-log preferences for a configuration or a virtual server, run the setConfigurationAccessLogProperties or otd_setVirtualServerAccessLogProperties commands.

    For example, the following command changes the location of the access log for the configuration foo to logs/access.log.

    props = {}
    props['configuration'] = 'foo'
    props['log-file'] = 'logs/access.log'
    otd_setConfigurationAccessLogProperties(props)
    

    For information about specifying a custom access-log format, see Using the Custom Access-Log Format in the Configuration File Reference for Oracle Traffic Director .

  • To disable the access log for a virtual server, run the otd_disableVirtualServerAccessLog command, as shown in the following example:

    props = {}
    props['configuration'] = 'foo'
    props['virtual-server'] = 'bar'
    otd_disableVirtualServerAccessLog(props)
    
  • To view the current server-log preferences for a configuration, run the otd_getLogProperties command.

    For example, the following command displays the server-log preferences for the configuration soa.

    props = {}
    props['configuration'] = 'foo'
    otd_getLogProperties(props)
    
    log-stdout=true
    log-stderr=true
    log-virtual-server-name=false
    create-console=false
    log-to-console=true
    log-to-syslog=false
    log-level=NOTIFICATION:1
    log-file=../logs/server.log
    
  • To set or change server-log preferences for a configuration, run the otd_setLogProperties command. Note that if you change the location of the server log, you should restart the instance for the change to take effect.

    For example, the following command changes the server-log level for the configuration foo to TRACE:32.

    props = {}
    props['configuration'] = 'foo'
    props['log-level'] = 'TRACE:32'
    otd_setLogProperties(props)
    

About Log Rotation

You can configure Oracle Traffic Director to automatically rotate (archive) the logs at specified intervals. You can also rotate the logs manually whenever required.

When the logs are rotated, the old log files are renamed with a suffix indicating the rotation date (in the yyyymmdd format) and 24-hour time (in the hhmm format). For example, the file name of the server log archive created at 11 p.m. on August 25, 2017 would be server-201108252300.log.

After log rotation, the server and access logs are re-initialized.

Note:

Rotate Access Log event will also rotate TCP access logs.

Rotating Logs Manually

You can rotate the logs manually whenever require. The server saves the old log files and marks the saved files with a name that includes the date and time when they were saved.

You can rotate the server and access logs of Oracle Traffic Director instances manually by using either Fusion Middleware Control or the WLST as described in the following topics:

Rotating Logs Manually Using Fusion Middleware Control

Rotate logs by using the Fusion Middleware Control

  1. Log in to Fusion Middleware Control, as described in Displaying Fusion Middleware Control..
  2. Click the WebLogic Domain button at the upper left corner of the page.
  3. Select Administration > OTD Configurations.
  4. Select the configuration for which you want to rotate logs.
  5. Click the Traffic Director Configuration In the Common Tasks pane.
  6. Select Administration > Log Rotation.
  7. If you want Oracle Traffic Director to run a specific command on the rotated log files, specify the absolute path to the required command in the Archive Command field
    1. Log in to Fusion Middleware Control, as described in Displaying Fusion Middleware Control.

    2. Click the WebLogic Domain button at the upper left corner of the page.

    3. Select Administration > OTD Configurations.

      A list of the available configurations is displayed.

    4. Select the configuration for which you want to rotate logs.

    5. Click the Traffic Director Configuration In the Common Tasks pane.

    6. Select Administration > Log Rotation.

    7. The Oracle Traffic Director Log Rotation window is displayed.

    8. If you want Oracle Traffic Director to run a specific command on the rotated log files, specify the absolute path to the required command in the Archive Command field

      1. For example, if you specify /usr/bin/gzip as the archive command, after rotating the logs, Oracle Traffic Director compresses the rotated log files by running the following commands:

        $ /usr/bin/gzip access-yyyymmddhhmm.log
        $ /usr/bin/gzip server-yyyymmddhhmm.log
        
      2. Click Rotate Logs Now.

        The server and access logs, including any virtual server-specific logs, for all the instances of the configuration are archived.

      To rotate logs for a specific instance of the selected configuration, do the following:

      1. In the navigation pane, select Instances.

        The Instances page is displayed.

      2. Click the Rotate Logs button for the required instance.

        The server and access logs, including any virtual server-specific logs, for the selected instance are archived.

      A message is displayed in the Console Messages pane confirming that the logs were rotated.

Rotating Logs Manually Using WLST

To rotating logs manually using WLST, do the following:

To rotate logs for an instance, run the otd_rotateLog command. For example, the following command rotates the access and server logs for the otd_foo_machine1 instance.

props = {}
props['instance'] = 'otd_foo_machine1'
otd_rotateLog(props)

Note:

If you want Oracle Traffic Director to run a specific command on the rotated log files, specify the absolute path to the required command by running the otd_setLogProperties command and specifying the archive-command property. as shown in the following example:

props = {}
props['configuration'] = 'foo'
props['archive-command] = '/usr/bin/gzip'
otd_setLogProperties(props)

In this example, after rotating the logs, Oracle Traffic Director compresses the rotated log files by running the following commands:

$ /usr/bin/gzip access-yyyymmddhhmm.log
$ /usr/bin/gzip server-yyyymmddhhmm.log

Configuring Oracle Traffic Director to Rotate Logs Automatically

You can configure Oracle Traffic Director to rotate logs automatically at specified times or intervals by creating log-rotation events.

You can create log-rotation events by using either Fusion Middleware Control or the WLST as described in the following topics:

Creating Log-Rotation Events Using Fusion Middleware Control

To create log-rotation events by using the Fusion Middleware Control, do the following:

  1. Log in to Fusion Middleware Control, as described in Graphical User Interface-Fusion Middleware Control.

  2. Click the WebLogic Domain button at the upper left corner of the page.

  3. Select Administration > OTD Configurations.

    A list of the available configurations is displayed.

  4. Select the configuration for which you want to rotate logs.

  5. Click the Traffic Director Configuration In the Common Tasks pane.

  6. Select Administration > Log Rotation.

  7. The Oracle Traffic Director Log Rotation window is displayed.

  8. If you want Oracle Traffic Director to run a specific command on the rotated log files, specify the absolute path to the required command in the Archive Command field.

    For example, if you specify /usr/bin/gzip as the archive command, after rotating the logs, Oracle Traffic Director compresses the rotated log files by running the following commands:

    $ /usr/bin/gzip access-yyyymmddhhmm.log
    $ /usr/bin/gzip server-yyyymmddhhmm.log
    
  9. Click Create.

    The New Log Rotation Event dialog box is displayed.

  10. Specify whether the event is for the server log or the access log.

  11. Specify the interval or time of the day at which the log should be updated, and then click OK.

    • A message, confirming creation of the event, is displayed in the Console Messages pane.

    • The new event is displayed in the Log Rotation Events list.

      • New events are enabled by default. To change the status, select the Enable/Disable check box.

      • To delete an event, click the Delete button.

Creating Log-Rotation Events Using WLST

To create log-rotation events, run the otd_createEvent command.

For example, the following commands configure Oracle Traffic Director to rotate the access logs and server logs for all instances of the configuration foo at 12pm.

props = {}
props['configuration'] = 'foo'
props['event'] = 'event-1'
props['command'] = 'rotate-log'
props['time'] = '12:00'
otd_createEvent(props)

props = {}
props['configuration'] = 'foo'
props['event'] = 'event-1'
props['command'] = 'rotate-access-log'
props['time'] = '12:00'
otd_createEvent(props)