Go to %JBOSS_HOME%\server\default\deploy\jboss-web.deployer folder and you will find server.xml. The Access logger is disabled by default. Just un-comment the access logger section and restart the JBoss application server. Rest is taken care.
Here is the Access logger configuration.
<Valve className="org.apache.catalina.valves.FastCommonAccessLogValve" prefix="localhost_access_log." suffix=".log" pattern="common" directory="${jboss.server.home.dir}/log" resolveHosts="false" />
The access log file will be created with the name - "localhost_access_log.2014-02-06" . The file is rotated every day. However, if required, you can modify the file name by reconfiguring. Generally, I would prefer to name it like node1_hostname_access.log where hostname is the name of the server in which JBoss is running. This will allow me to process and analyze several log files in a cluster environment without any ambiguity.
As other standard servers support, JBoss also supports two log format patterns - 1) common and 2) combined.
Apart from common and combined, you can also customize the log format as you wish. I have customized to my requirement as follows: -
<Valve className="org.apache.catalina.valves.AccessLogValve"
prefix="node1_hostname_access." suffix=".log"
pattern="%a %A %u %t %r %s %T %b %S" directory="${jboss.server.home.dir}/log"
resolveHosts="false" />
Please read https://docs.jboss.org/jbossweb/latest/config/valve.html for more information on the parameters.
See below sample access log generated.
127.0.0.1 10.xx.xx.xx- [06/Feb/2014:16:01:07 +0530] GET /web-console/ HTTP/1.1 304 0.007 - -
127.0.0.1 10.xx.xx.xx- [06/Feb/2014:16:01:07 +0530] GET /web-console/applet.jsp HTTP/1.1 200 0.041 444 93300E3B983D53F8BE5FB39901E48B6B
127.0.0.1 10.xx.xx.xx- [06/Feb/2014:16:01:07 +0530] GET /web-console/ServerInfo.jsp HTTP/1.1 200 0.060 4226 93300E3B983D53F8BE5FB39901E48B6B
127.0.0.1 10.xx.xx.xx- [06/Feb/2014:16:01:07 +0530] GET /web-console/css/jboss.css HTTP/1.1 304 0.000 - 93300E3B983D53F8BE5FB39901E48B6B
127.0.0.1 10.xx.xx.xx- [06/Feb/2014:16:01:07 +0530] GET /web-console/images/logo.gif HTTP/1.1 304 0.000 - 93300E3B983D53F8BE5FB39901E48B6B
127.0.0.1 10.xx.xx.xx- [06/Feb/2014:16:01:07 +0530] POST /web-console/Invoker HTTP/1.1 200 0.439 2245739 93300E3B983D53F8BE5FB39901E48B6B
127.0.0.1 10.xx.xx.xx- [06/Feb/2014:16:01:07 +0530] GET /web-console/%5bLorg/jboss/console/manager/interfaces/ResourceTreeNode.class; HTTP/1.1 404 0.001 1177 93300E3B983D53F8BE5FB39901E48B6B
Hope you liked the tip.
Here is the Access logger configuration.
<Valve className="org.apache.catalina.valves.FastCommonAccessLogValve" prefix="localhost_access_log." suffix=".log" pattern="common" directory="${jboss.server.home.dir}/log" resolveHosts="false" />
The access log file will be created with the name - "localhost_access_log.2014-02-06" . The file is rotated every day. However, if required, you can modify the file name by reconfiguring. Generally, I would prefer to name it like node1_hostname_access.log where hostname is the name of the server in which JBoss is running. This will allow me to process and analyze several log files in a cluster environment without any ambiguity.
As other standard servers support, JBoss also supports two log format patterns - 1) common and 2) combined.
Apart from common and combined, you can also customize the log format as you wish. I have customized to my requirement as follows: -
<Valve className="org.apache.catalina.valves.AccessLogValve"
prefix="node1_hostname_access." suffix=".log"
pattern="%a %A %u %t %r %s %T %b %S" directory="${jboss.server.home.dir}/log"
resolveHosts="false" />
Please read https://docs.jboss.org/jbossweb/latest/config/valve.html for more information on the parameters.
See below sample access log generated.
127.0.0.1 10.xx.xx.xx- [06/Feb/2014:16:01:07 +0530] GET /web-console/ HTTP/1.1 304 0.007 - -
127.0.0.1 10.xx.xx.xx- [06/Feb/2014:16:01:07 +0530] GET /web-console/applet.jsp HTTP/1.1 200 0.041 444 93300E3B983D53F8BE5FB39901E48B6B
127.0.0.1 10.xx.xx.xx- [06/Feb/2014:16:01:07 +0530] GET /web-console/ServerInfo.jsp HTTP/1.1 200 0.060 4226 93300E3B983D53F8BE5FB39901E48B6B
127.0.0.1 10.xx.xx.xx- [06/Feb/2014:16:01:07 +0530] GET /web-console/css/jboss.css HTTP/1.1 304 0.000 - 93300E3B983D53F8BE5FB39901E48B6B
127.0.0.1 10.xx.xx.xx- [06/Feb/2014:16:01:07 +0530] GET /web-console/images/logo.gif HTTP/1.1 304 0.000 - 93300E3B983D53F8BE5FB39901E48B6B
127.0.0.1 10.xx.xx.xx- [06/Feb/2014:16:01:07 +0530] POST /web-console/Invoker HTTP/1.1 200 0.439 2245739 93300E3B983D53F8BE5FB39901E48B6B
127.0.0.1 10.xx.xx.xx- [06/Feb/2014:16:01:07 +0530] GET /web-console/%5bLorg/jboss/console/manager/interfaces/ResourceTreeNode.class; HTTP/1.1 404 0.001 1177 93300E3B983D53F8BE5FB39901E48B6B
Hope you liked the tip.
No comments:
Post a Comment