+

Search Tips   |   Advanced Search

Configure ODR custom logs

By configuring custom logs for ODR, we can determine what data to capture in the logs and how to display the logged data. We can configure custom logs using the wsadmin command, through rule set administrative tasks, or using the manageODR.py script.

With custom logging, the on demand router records customized entries to log files based on defined conditions. For each request, the ODR evaluates the rule conditions. For each fulfilled condition, the ODR logs an entry in the custom log file. For example, a specific URL or a specific virtual host name.

Validation is limited to type checking. Thorough validation is performed during the ODR startup. Problems are reported through runtime exceptions recorded in the SystemOut log file.


Tasks

  1. Create a rule set:

      wsadmin>$AdminTask createRuleset 
      {
          -odrname odr1 
          -nodename myNode01 
          -rulesetName myRuleset 
          -rulesetType HTTP 
          -defaultContinue true }    
      

  2. Add a rule to the rule set, with the expression set to match when the virtual host is NOT badvhost.

      wsadmin>$AdminTask addRuleToRuleset 
      {
          -odrname odr1 
          -nodename myNode01 
          -rulesetName myRuleset 
          -ruleName myRule 
          -rulePriority 0 
          -expression "virtualhost <> 'badvhost'"
      }    
      

  3. Add a custom log action.

    the @ symbol used in the actionValue argument. The following example shows the wsadmin command for listing the configurable attributes for the action and the results:

      wsadmin>$AdminTask addActionToRule 
      {
          -odrname odr1 
          -nodename myNode01 
          -rulesetName myRuleset 
          -ruleName myRule 
          -actionName myCustomLogAction 
          -actionType log 
          -actionValue "Custom1.log %r %B %h %z %Z@Custom2.log %t %r %s" 
          -actionContinue true }    
      

  4. Save changes.

      wsadmin>$AdminConfig save


Example

Two examples of custom log outputs follow. These examples are based on the formats specified in the previous actions, after running several HTTP requests.

"GET /BADAPP HTTP/1.1" 70 myremotehost.mycompany.com - -
"GET /A/ServerInfo HTTP/1.1" 422 myremotehost.mycompany.com 9.44.111.191 myCell01/myNode01/MyClusterA_myNode01
"GET /A/ServerInfo HTTP/1.1" 90 myremotehost.mycompany.com - -
"GET /favicon.ico HTTP/1.1" 70 myremotehost.mycompany.com - -
"GET /favicon.ico HTTP/1.1" 70 myremotehost.mycompany.com - -
"GET /A/ServerInfo HTTP/1.1" 422 myremotehost.mycompany.com 9.44.111.191 myCell01/myNode01/MyClusterA_myNode01
"GET /A/ServerInfo HTTP/1.1" 422 myremotehost.mycompany.com 9.44.111.191 myCell01/myNode01/MyClusterA_myNode01
01/Jul/2009:20:35:35 EDT "GET /BADAPP HTTP/1.1" 404
01/Jul/2009:20:35:43 EDT "GET /A/ServerInfo HTTP/1.1" 200
01/Jul/2009:20:37:21 EDT "GET /A/ServerInfo HTTP/1.1" 503
01/Jul/2009:20:37:21 EDT "GET /favicon.ico HTTP/1.1" 404
01/Jul/2009:20:37:24 EDT "GET /favicon.ico HTTP/1.1" 404
01/Jul/2009:20:42:55 EDT "GET /A/ServerInfo HTTP/1.1" 200
01/Jul/2009:20:42:59 EDT "GET /A/ServerInfo HTTP/1.1" 200


Subtopics


Related:

  • Custom log file format
  • Use centralized logging to diagnose problems
  • Ruleset administrative tasks
  • manageODR.py script
  • Intelligent Management: HTTP operands