You can use the manageODR.py script
to manage custom logging and create a cluster of on demand routers
(ODR).
Location
The manageODR.py script
is located in the app_server_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.
Operations
You can perform the following
operations with the
manageODR.py script:
- convertToCluster <node:odr> <cluster>:
Convert an existing ODR on node node with name odr to
an ODR cluster named <cluster>.
- createDynamicCluster <cluster> <nodeGroup>:
Create an ODR dynamic cluster named <cluster> on
nodes in node group <nodeGroup>.
- addToCluster <node:odr> <cluster>:
Create a new ODR on node node with name odr and
add it to ODR cluster cluster.
- insertMultiClusterRoutingRule <odrServerOrCluster> <protocolFamily> <ruleNumber> <condition> <multiClusterAction> <multiClusterSpecification>:
Insert an ODR routing rule with an action to load balance or failover
between clusters in the same, or different, cells.
- insertRedirectRoutingRule <odrServerOrCluster> <protocolFamily> <ruleNumber> <condition> <redirectURL>:
Insert an ODR routing rule with an action to return a redirect to
the client. This is only supported for the HTTP protocol family.
- insertRejectRoutingRule <odrServerOrCluster> <ruleNumber> <condition> <errorCode>:
Insert an ODR routing rule with an action to return a specific error
code to the client. This is only supported for the HTTP protocol
family.
- removeRoutingRule <odrServerOrCluster> <protocolFamily> <ruleNumber> :
Remove the ODR routing rule specified by the protocol family (for
example the HTTP protocol family), and rule number.
- listRoutingRules <odrServerOrCluster> <protocolFamily>:
List the ODR routing rules for the specified protocol family (for
example the HTTP protocol family).
- insertLocalContentRoutingRule <odrServerOrCluster> <ruleNumber> <condition> <localPath>:
Insert an ODR routing rule with an action to serve static HTML content
from the local file system of the ODR.
- insertCustomLogRule <odrServerOrCluster> <ruleNumber> <condition> <logFileFormat>:
Insert a custom log rule into the list at position <ruleNumber>.
- RemoveCustomLogRule <odrServerOrCluster> <ruleNumber>:
Remove the custom log rule number <ruleNumber>.
- listCustomLogRules <odrServerOrCluster>:
List the custom log rules associated with an ODR or ODR cluster. The
arguments are:
- <node:odr> is the name of the node and ODR
(for example, mynode:myodr).
- <cluster> is the name of a cluster.
- <odrServerOrCluster> is either <node:odr> or <cluster>.
- <protocolFamily> is either "HTTP" or "SIP".
- <ruleNumber> is the number of the rule,
from 1 to the total number of rules.
- <condition> is the condition (i.e. boolean
expression) which must evaluate totrue to trigger
the associated custom logging.
- <multiClusterAction> is one of "Failover",
"WLOR" (Weighted Least Outstanding Requests), or "WRR" (Weighted Round
Robin).
- <multiClusterSpecification> is a specification
of multiple clusters in one of the following formats:
- cluster = <cellname>/<clustername>:
to specify a specific cluster.
- server = <cellname>/<nodename>/<servername>:
to specify a specific server.
- module= <cellName>/<applicationName>/<editionName>/<moduleName>:
to specify all servers to which this module is deployed.
- <redirectUR> is the URL to redirect the
request to.
- <errorCode> is the error return code to
return for a reject routing rule.
- <logFileFormat> is a specification denoting
the file name and format of the log entry.
- <localPath> is the directory from which
to serve local static content.
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 ODRCluster
The 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
The following example shows how to add a custom log rule
at position 1 to log errors that can occur when writing
a response to a client in the response.write.error.log:
wsadmin.sh
-f manageODR.py -lang jython insertCustomLogRule node1:odr 1 "response.write.error"
"response.write.error.log %t %r %s"