By default, JBoss EAP 7 rotates its access log daily.
I needed to set this to like, HOURLY.
Reason:
We have a script that automatically downloads the rotated access log file.
But doing this ^ would greatly increase CPU usage (because the access log at the end of the day is VERY large, and our system's performance is unfortunately reduced while downloading it)
What I know is that, in the standalone.xml, I've tried adding the one below to make the JBoss server log to rotate every hour.
<suffix value=".yyyy-MM-dd-HH"/>
But this method does not apply to access log (because its settings is weirdly placed in a different part of the standalone.xml)
I've tried experimenting with the access-log tags to have any of the following. But it just throws an error.
<access-log suffix=".yyyy-MM-dd-HH" ...
<access-log rotate="hourly" ...
...and i can't seem to find a VERY detailed guide about standalone.xml of JBoss EAP 7. I'm thinking that I should use a tag value for the access-log part.
Please help. Does anyone know of a way to do this? :(
System specs
Oracle Linux 6.9
JBoss EAP 7
Thanks and best regards.
Try following
<subsystem xmlns="urn:jboss:domain:logging:3.0">
...(snip)...
<!-- size-based log rotation -->
<size-rotating-file-handler name="access-log" autoflush="true">
<formatter>
<named-formatter name="access-log-formatter"/>
</formatter>
<file relative-to="jboss.server.log.dir" path="access.log"/>
<rotate-size value="10m"/>
<max-backup-index value="10"/>
<append value="true"/>
</size-rotating-file-handler>
<! -- or custom interval (hourly) log rotation
<periodic-rotating-file-handler name="access-log-custom" autoflush="true">
<formatter>
<named-formatter name="access-log-formatter"/>
</formatter>
<file relative-to="jboss.server.log.dir" path="access.log"/>
<suffix value=".yyyy-MM-dd-HH"/>
<append value="true"/>
</periodic-rotating-file-handler>
--->
...(snip)...
<logger category="io.undertow.accesslog" use-parent-handlers="false">
<handlers>
<handler name="access-log"/>
</handlers>
</logger>
...(snip)...
<formatter name="access-log-formatter">
<pattern-formatter pattern="%s%n"/>
</formatter>
</subsystem>
...(snip)...
<subsystem xmlns="urn:jboss:domain:undertow:3.1" statistics-enabled="true">
...(snip)...
<server name="default-server">
<http-listener name="default" socket-binding="http" redirect-socket="https" record-request-start-time="true"/>
<host name="default-host" alias="localhost">
...(snip)...
<access-log use-server-log="true" pattern="%h %l %u %t "%r" %s %b "%{i,Referer}" "%{i,User-Agent}" "%{i,COOKIE}" "%{o,SET-COOKIE}" %S "%I" %T"/>
...(snip)...
</host>
</server>
...(snip)...
</subsystem>
Related
I am looking for a solution in JBOSS EAP 6.3 for the automatic deletion of access logs. I have added the below configuration to get the access logs printed in a different file but it doesn't have any parameter to delete the files after a specific interval.
<access-log pattern="%h %l %u %t %r %s %b %S %T" prefix="access_log_" rotate="true">
<directory path="." />
</access-log>
In standalone.xml , you can have log handler configuration based on the size.
<size-rotating-file-handler name="FILE" autoflush="true">
<formatter>
<named-formatter name="PATTERN"/>
</formatter>
<file relative-to="jboss.server.log.dir" path="server.log"/>
<rotate-size value="1M"/>
<max-backup-index value="1"/>
<append value="true"/>
</size-rotating-file-handler>
I'm trying to replace the Wildfly 10 default homepage (accessed from http://hostname:port) by one of my own web application.
I found a good way to do it by removing some parts of the undertow subsystem of the standalone.xml of my wildfly and by adding a war to the default-web-module.
My problem is that I don't have a war, I have a ear (with a war in it), and it doesn't work with that.
Hereunder is the undertow part of my standalone.xml file :
<subsystem xmlns="urn:jboss:domain:undertow:3.1">
<buffer-cache name="default"/>
<server name="default-server">
<http-listener name="default" socket-binding="http" redirect-socket="https" enable-http2="true"/>
<https-listener name="https" socket-binding="https" security-realm="ApplicationRealm" enable-http2="true"/>
<host name="default-host" alias="localhost" default-web-module="myear.ear/mywar.war">
<access-log pattern="%{i,X-Forwarded-For} %h %{i,SM_UNIVERSALID} %t %H %p %U %q %s %D %T" prefix="http-in" suffix=".log"/>
</host>
</server>
<servlet-container name="default">
<jsp-config/>
<websockets/>
</servlet-container>
<filters>
<response-header name="server-header" header-name="Server" header-value="WildFly/10"/>
<response-header name="x-powered-by-header" header-name="X-Powered-By" header-value="Undertow/1"/>
</filters>
</subsystem>
Can this solution work with an ear instead of a war, or have I to find another way ?
Thank you in advance,
Seb
Finally, I solved it by redirecting the index.html page of the welcome-content folder of WildFly to my application, it's simpler and it works perfectly.
Seb
In Jboss 7.1 how to configure standalone.xml to log only INFO level
<periodic-rotating-file-handler name="FILE">
<level name="INFO"/>
<formatter>
<pattern-formatter pattern="%z{utc}%d{MM/dd/yyyy HH:mm:ss,SSS} %-5p [%c] %s%E%n"/>
</formatter>
<file relative-to="jboss.server.log.dir" path="server.log"/>
<suffix value=".yyyy-MM-dd"/>
<append value="true"/>
</periodic-rotating-file-handler>
By default root loggers are configured to print INFO level logs. If you have to change log level for any other logger category or log handlers. Just add below tag to that particular category or handler.
<level name="INFO"/>
If you have log only INFO level logs, you will have t0 implement filter something like
<filter-spec value="(levels(INFO))"/>
Sometimes we have the issue that the log rotate will duplicate the current log file until the disk runs out of space. We don't see any issues in the log files and we were wondering how this could happen as we are using the standard PeriodicSizeRotatingFileHandler from JBoss.
Server version: Windows Web Server 2008 R2
JBoss EAP version: 6.4.17
Please find below a part of our standalone.xml
<subsystem xmlns="urn:jboss:domain:logging:1.5">
<custom-handler name="FILE" class="org.jboss.logmanager.handlers.PeriodicSizeRotatingFileHandler" module="org.jboss.logmanager">
<level name="INFO"/>
<formatter>
<pattern-formatter pattern="%d{yyyyMMdd HH:mm:ss,SSS} %-5p [%c{1}] (%t) %s%E [MDC:ibizaId=%X{ibizaId}]%n"/>
</formatter>
<properties>
<property name="append" value="true"/>
<property name="rotateSize" value="200000000"/>
<property name="maxBackupIndex" value="1000"/>
<property name="suffix" value=".yyyy-MM-dd"/>
<property name="fileName" value="${jboss.server.log.dir}/server.log"/>
</properties>
</custom-handler>
</subsystem>
Unfortunately I couldn't find anything related to this issue on Google.
I'm using JBoss 7.1.3 on Mac 10.9.1. This is a development machine. How do I delete old server logs that appear under the
$JBOSS_HOME/standalone/log
directory? Ideally, I'd like logs older than 4 days to be deleted from my system, freeing up disk space.
I am not sure whether you can auto delete files based on time lines of 4 days, the
<periodic-rotating-file-handler>
does not have the provision to do so.
However since your requirement is to free the disk space you can achieve that by using your config file (standalone or domain.xml).
By default the config file logging setting comes with periodic-rotating-file setting which looks like:
<periodic-rotating-file-handler name="FILE" autoflush="true">
<formatter>
<pattern-formatter pattern="%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/>
</formatter>
<file relative-to="jboss.server.log.dir" path="server.log"/>
<suffix value=".yyyy-MM-dd"/>
<append value="true"/>
</periodic-rotating-file-handler>
Please change it to size-rotating-file-handler and define the log size(rotate-size) that you would want to maintain and the number of files(max-backup-index) by doing this you have fixed the size of your log directory and always rotate within the given size allocations.
<size-rotating-file-handler name="FILE" autoflush="true" >
<formatter>
<pattern-formatter pattern="%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/>
</formatter>
<file relative-to="jboss.server.log.dir" path="server.log"/>
<append value="true"/>
<rotate-size value="10000K"/>
<max-backup-index value="3"/>
</size-rotating-file-handler>
Note that suffix does not work with <size-rotating-file-handler>
For more info