12.3 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 the administration console or the CLI.

Note:

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:

  1. Log in to the administration console, as described in Section 2.3.2, "Accessing the Administration Console."

  2. Click the Configurations button that is situated at the upper left corner of the page.

    A list of the available configurations is displayed.

  3. Select the configuration for which you want to configure log preferences.

    • To change log preferences for the entire configuration, select Logging in the navigation pane.

    • To set or change the log preferences for a specific virtual server in the configuration, expand Virtual Servers in the navigation pane, select the virtual server for which you want to define log preferences, and then select Logging.

    The Log Preferences page is displayed.

  4. Specify the parameters that you want to change.

    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 Oracle Traffic Director Configuration Files Reference.

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

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

  5. After making the required changes, click Save.

    • A message, confirming that the updated configuration was saved, is displayed in the Console Messages pane.

    • In addition, the Deployment Pending message is displayed at the top of the main pane. You can either deploy the updated configuration immediately by clicking Deploy Changes, or you can do so later after making further changes as described in Section 4.3, "Deploying a Configuration."

Configuring Log Preferences Using the CLI

  • 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.