Configure custom logs
By configuring custom logs, we can determine what data to capture in the logs and how to display the logged data. We can configure custom logs using wsadmin, through rule set administrative tasks, or using the manageODR.py script.
With custom logging, the on demand router (ODR) 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.
- Create a rule set:
wsadmin>$AdminTask createRuleset {-odrname odr1 -nodename myNode01 -rulesetName myRuleset -rulesetType HTTP -defaultContinue true}
- Add a rule to the rule set created, 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'"}
- Add a custom log action. Note the @ symbol used in the actionValue argument. The following example shows wsadmin 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}
- Save the 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_myNode0101/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
- (dist)(zos) Custom log file format
When a request is processed, we can create rule sets to specify what data to include in the logs, the display order, the conditional logic for filtering which requests are included, and the log file number and names.
Related concepts
Custom log file format
Ruleset administrative tasks manageODR.py script Intelligent Management: HTTP operands