This chapter contains the following sections:
Each Oracle Traffic Director instance, including the administration server, has two logs—an access log and a server log. The instance logs are enabled by default and initialized when the instance is started for the first time. In addition to the instance logs, 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 INSTANCE_HOME
/net-
config_name
/logs
directory.
For the administration server, the default location of the log files is INSTANCE_HOME
/admin-server/logs
directory.
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.
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. For more information, see Configuring Log Preferences.
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. For more information, see Configuring Log Preferences.
Table 12-1 lists the log levels that you can specify for the server log.
Table 12-1 Server Log Levels
Log Level | Description |
---|---|
|
A serious problem caused by unknown reasons. You should contact Oracle for support. |
|
A serious problem that requires your immediate attention. |
|
A potential problem that you should review. |
|
A major lifecycle event, such as a server being started or restarted. |
|
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.
You can view the access and server logs of Oracle Traffic Director instances and virtual servers by using either the administration console or the CLI.
Note:
Besides using the CLI and administration console, 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 the administration console and the get-access-log
CLI command display only the log entries that currently exist in the access log file on the disk. They do not display items from the access-log buffer (see Configuring Access-Log Buffer Settings)).
The CLI examples in this section are shown in shell mode (tadm>
). For information about invoking the CLI shell, see Accessing the Command-Line Interface.
Viewing Logs Using the Administration Console
To view log data for a node, an instance, or virtual server within an instance by using the administration console, do the following:
To view the access log for an instance or a virtual server, run the get-access-log
command.
For example, the following command displays the access-log records with status=304 for the instance of the configuration soa
running on the node example.com
.
tadm> get-access-log --status-code=304 --config=soa example.com
format=%Ses->client.ip% - %Req->vars.auth-user% [%SYSDATE%] "%Req->reqpb.clf-request%" %Req->srvhdrs.clf-status% %Req->srvhdrs.content-length%
10.177.243.207 - - [25/Aug/2011:04:41:34 -0700] "GET / HTTP/1.1" 304 0
10.177.243.207 - - [25/Aug/2011:04:41:35 -0700] "GET / HTTP/1.1" 304 0
The first line shows the format that is currently defined for the access log.
To view the access log for a particular virtual server within the instance, specify the virtual server name by using the --vs
option.
To view the server log for an instance or a virtual server, run the get-log
command.
For example, the following command displays the server-log records with log level warning:1
or higher for the instance of the configuration soa
running on the node example.com
.
tadm> get-log --log-level=warning:1 --config=soa example.com
To view the server log for a particular virtual server within the instance, specify the virtual server name by using the --vs
option.
get-access-log
and get-log
, see the Oracle Traffic Director Command-Line Reference or run the commands with the --help
option.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 the administration console or the CLI.
Note:
To change the log preferences for the administration server, you should change the properties of the administration server as described in Changing Administration Server Settings.
The CLI examples in this section are shown in shell mode (tadm>
). For information about invoking the CLI shell, see Accessing the Command-Line Interface.
Configuring Log Preferences Using the Administration Console
To configure log preferences for a configuration or a virtual server by using the administration console, do the following:
To view the current access-log preferences for a configuration or a virtual server, run the get-access-log-prop
command.
For example, the following command displays the access-log preferences for the configuration soa
.
tadm> get-access-log-prop --config=soa
enabled=true
file=../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%
mode=text
To view the access-log preferences for a particular virtual server in the configuration, run get-access-log-prop
with the --vs
option.
To set or change access-log preferences for a configuration or a virtual server, run the enable-access-log
command.
For example, the following command changes the location of the access log for the configuration soa
to INSTANCE_HOME/net-
config_name
/logs/access
.
tadm> enable-access-log --config=soa --file=../logs/access
OTD-70201 Command 'enable-access-log' ran successfully.
Note:
If you specify a relative path for the log-file directory, the path is taken to be relative to the config
directory of the instance.
To set or change the access-log location and format for a particular virtual server in the configuration, run enable-access-log
with the --vs
option.
For information about specifying a custom access-log format, see "Using the Custom Access-Log Format" in the Oracle Traffic Director Configuration Files Reference.
To disable the access log for a configuration or a virtual server, run the disable-access-log
command, as shown in the following example:
tadm> disable-access-log --config=soa
OTD-70201 Command 'disable-access-log' ran successfully.
To disable the access log for a particular virtual server in the configuration, run disable-access-log
with the --vs
option.
To view the current server-log preferences for a configuration, run the get-log-prop
command.
For example, the following command displays the server-log preferences for the configuration soa
.
tadm> get-log-prop --config=soat
create-console=false
log-file=../logs/server.log
log-to-syslog=false
log-virtual-server-name=false
log-stdout=true
log-level=NOTIFICATION:1
log-to-console=true
log-stderr=true
To view the server-log location for a particular virtual server in a configuration, run the get-virtual-server-prop
command, as shown in the following example:
tadm> get-virtual-server-prop --config=soa --vs=vs1 log-file
To set or change server-log preferences for a configuration, run the set-log-prop
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 soa
to WARNING:1
.
tadm> set-log-prop --config=soa log-level=WARNING:1
OTD-70201 Command 'set-log-prop' ran successfully.
To set or change server-log preferences for a virtual server, run the set-virtual-server-prop
command.
For example, the following command changes the server-log location for the virtual server vs1
in the configuration soa
to INSTANCE_HOME/net-
config_name
/log/server
.
tadm> set-virtual-server-prop --config=soa --vs=vs1 log-file=../log/server
OTD-70201 Command 'set-virtual-server-prop' ran successfully.
Note:
If you specify a relative path for the log-file directory, the path is taken to be relative to the config
directory of the instance.
For the updated configuration to take effect, you should deploy it to the Oracle Traffic Director instances by using the deploy-config
command. If you change the location of the server log, you should restart the instance for the change to take effect
For more information about the CLI commands mentioned in this section, see the Oracle Traffic Director Command-Line Reference or run the commands with the --help
option.
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, 2011 would be server-201108252300.log
.
After log rotation, the server and access logs are re-initialized.
For information about how to rotate logs, see Rotating Logs Manually and Configuring Oracle Traffic Director to Rotate Logs Automatically.
Note:
Rotate Access Log event will also rotate TCP access logs.
You can rotate the server and access logs of Oracle Traffic Director instances manually by using either the administration console or the CLI.
Note:
The CLI examples in this section are shown in shell mode (tadm>
). For information about invoking the CLI shell, see Accessing the Command-Line Interface.
Rotating Logs Manually Using the Administration Console
To rotate logs by using the administration console, do the following:
Log in to the administration console, as described in Accessing the Administration Console.
Click the Configurations button that is situated at the upper left corner of the page.
A list of the available configurations is displayed.
Select the configuration for which you want to rotate logs.
To rotate logs for all the instances of the selected configuration, do the following:
In the navigation pane, select Logging.
The Log Preferences page is displayed.
Go to the Log Rotation section of the page.
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
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:
In the navigation pane, select Instances.
The Instances page is displayed.
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 the CLI
To rotate logs for one or more instances of a configuration, run the rotate-log
command.
For example, the following command rotates the access and server logs, including any virtual server-specific logs, for the instance of the configuration soa
running on the nodes soa1.example.com
and soa2.example.com
.
tadm> rotate-log --config=soa soa1.example.com soa2.example.com
OTD-70201 Command 'rotate-log' ran successfully.
If you do not specify any node, the logs are rotated for all the instances of the configuration.
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 set-log-prop
command as shown in the following example:
tadm> set-log-prop --config=soa archive-command=/usr/bin/gzip
OTD-70201 Command 'set-log-prop' ran successfully.
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
For more information about rotate-log
and set-log-prop
, see the Oracle Traffic Director Command-Line Reference or run the command with the --help
option.
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 the administration console or the CLI.
Note:
The CLI examples in this section are shown in shell mode (tadm>
). For information about invoking the CLI shell, see Accessing the Command-Line Interface.
Oracle Java Cloud Service configures Oracle Traffic Director to rotate logs automatically when you create an Oracle Java Cloud Service instance with a load balancer or add a load balancer to an Oracle Java Cloud Service instance.
Creating Log-Rotation Events Using the Administration Console
To create log-rotation events by using the administration console, do the following:
To create log-rotation events, run the create-event
command.
For example, the following commands configure Oracle Traffic Director to rotate the access logs and server logs for all instances of the configuration soa
after every 3600 seconds and 7200 seconds respectively.
tadm> create-event --config=soa --command=rotate-access-log --interval=3600 OTD-70201 Command 'create-event' ran successfully. tadm> create-event --config=soa --command=rotate-log --interval=7200 OTD-70201 Command 'create-event' ran successfully.
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 set-log-prop
command as shown in the following example:
tadm> set-log-prop --config=soa archive-command=/usr/bin/gzip
OTD-70201 Command 'set-log-prop' ran successfully.
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
For the updated configuration to take effect, you should deploy it to the Oracle Traffic Director instances by using the deploy-config
command.
For more information about create-event
, see the Oracle Traffic Director Command-Line Reference or run the command with the --help
option.