You can use the manageODR.py script to manage custom logging and create a cluster of on demand routers (ODR).
The manageODR.py script is located in the install_root/bin directory. Before running this script, ensure that you have the environment variable WAS_HOME configured to point to the directory of your WebSphere installation.
Argument | Description |
---|---|
<node:odr> |
Name of the node and ODR. For example, mynode:myodr. |
<cluster> |
Name of an ODR cluster. |
<odrServerOrCluster> |
Is either <node:odr> or <cluster> |
<ruleNumber> |
Number of the rule, from 1 to the total number of rules (or larger for insertCustomLogRule). |
<condition> |
Condition (that is, boolean expression) which must evaluate to true in order to trigger the associated custom logging. |
<logFileFormat> |
Specification denoting the file name and format of the log entry. See the log action format section in the Custom logs overview topic. |
The following example shows how to create an HTTP ODR named odr, on node 1:
wsadmin.sh -f createodr.jacl node1 odr odr
The following example shows how to convert an ODR named odr on node node1 to an ODR cluster named ODRCluster:
wsadmin.sh -f manageODR.py -lang jython convertToCluster node1:odr ODRClusterThe following example shows how to add a custom log rule to put all requests whose service time is longer than 2 seconds in the slow.log custom log, and include the application server to which the request was sent and the service time:
wsadmin.sh -f manageODR.py -lang jython insertCustomLogRule myNode02:odr1 1 "service.time > 2000" "slow.log %t %r %Z %T"The following example shows how to add a custom log rule to put all 503 responses in 503.log. The rule is added at position 2. If there is an existing rule at position 2, the new rule is inserted before the existing rule.
wsadmin.sh -f manageODR.py -lang jython insertCustomLogRule myNode02:odr1 2 "response.code = 503" "503.log %t %r %s