Wednesday, 15 March 2017

Enable Access logs in Wildfly 8.1


In order to enable access logs in Wildfly 8.1,Please refer below steps:

  1. Go to WILDFLY_HOME/standalone/configuration folder.
  2. Open Standalone.xml and put following snippet under <subsystem xmlns="urn:jboss:domain:undertow:1.2">

 <subsystem xmlns="urn:jboss:domain:undertow:1.2">  
       <buffer-cache name="default"/>  
       <server name="default-server">  
         <http-listener name="default" socket-binding="http" record-request-start-time="true"/>  
         <host name="default-host" alias="localhost">  
           <location name="/" handler="welcome-content"/>  
           <access-log pattern="%h&#x9;%p&#x9;%l&#x9;%u&#x9;%t&#x9;&quot;%r&quot;&#x9;%s&#x9;%b&#x9;&quot;%{i,Referer}&quot;&#x9;&quot;%{i,User-Agent}&quot;&#x  
 9;%D&#x9;&quot;%{i,X-Forwarded-For}&quot;&#x9;&quot;%{i,True-Client-IP}&quot;&#x9;&quot;%{i,JSESSIONID}c&quot;" directory="${jboss.server.log.dir}" prefix="access-log"  
 worker="default" rotate="true"/>  
           <filter-ref name="server-header"/>  
           <filter-ref name="x-powered-by-header"/>  
         </host>  
       </server>  
       <servlet-container name="default">  
         <jsp-config/>  
         <websockets/>  
       </servlet-container>  
       <handlers>  
         <file name="welcome-content" path="${jboss.home.dir}/welcome-content"/>  
       </handlers>  
       <filters>  
         <response-header name="server-header" header-name="Server" header-value="WildFly/8"/>  
         <response-header name="x-powered-by-header" header-name="X-Powered-By" header-value="Undertow/1"/>  
       </filters>  
     </subsystem>  



For access log pattern configuration, refer Access log Patterns

Enjoy Learning.

No comments:

Post a Comment