This service will be undergoing maintenance at 00:00 UTC, 2017-10-23 It is expected to last about 30 minutes
Bug 1023466 - RFE: RHQ 4.9 - Server logs do not rotate based on size of log file
RFE: RHQ 4.9 - Server logs do not rotate based on size of log file
Status: NEW
Product: RHQ Project
Classification: Other
Component: Core Server, Performance (Show other bugs)
4.9,4.8
All All
unspecified Severity unspecified (vote)
: ---
: ---
Assigned To: RHQ Project Maintainer
Mike Foley
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-10-25 09:35 EDT by Stian Lund
Modified: 2015-11-01 19:45 EST (History)
6 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Stian Lund 2013-10-25 09:35:15 EDT
Description of problem:

Since RHQ went with EAP 6 the logs, specifically server.log does not rotate like the old rhq-server-log4j.log did.

This could potentially lead to serious problems if the server has an issue that leads to excessive logging. I've seen 200 MB/day for an error with initializing a servlet.

AFAIK, the logging is now controlled by /opt/rhq/rhq-server/jbossas/standalone/configuration/standalone-full.xml, and this is where the problem is, in that the default log-definition in Jboss does not rotate the server.log.

This could be easily remedied by changing to a size rotating file handler:

                <size-rotating-file-handler name="FILE">  
                    <formatter>  
                        <pattern-formatter pattern="%d %-5p [%c] (%t) %s%E%n"/>  
                    </formatter>  
                    <file relative-to="jboss.server.log.dir" path="server.log"/>  
                    <rotate-size value="10m"/>  
                    <max-backup-index value="5"/>  
                    <append value="true"/>  
                </size-rotating-file-handler>  


(I guess 5x10MB is a pretty standard setting)

Also there seems to be references to the file in logging.properties but not sure how related that is.

IMO the default log handler in Jboss should be changed to size-rotating as standard, non-rotating files are very nasty 

Version-Release number of selected component (if applicable):
4.9 Final (was also in 4.8)

Additional info:
Did not provide repro steps as I think this one's pretty obvious.
Comment 1 John Mazzitelli 2013-10-25 10:36:49 EDT
I see that RHQ uses this - this comes from the out of box EAP config which is already using a periodic rotating log - i think this rotates daily:

           <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>
Comment 2 John Mazzitelli 2013-10-25 10:49:31 EDT
just documenting the file handlers that are available for future reference:

https://docs.jboss.org/author/display/AS72/Logging+Configuration

I'm changing this to a RFE BZ and altering the title to make it clear that the log file doesn't rotate *based on size*, but it does rotate (it is doing so daily). It's a question whether or not we want to have it rotate based on size versus rotate on a set periodic basis (which is the default EAP behavior). I'll leave that for future discussion, but I'll leave the code as is for now since we are merely following the default EAP behavior.
Comment 3 Elias Ross 2013-10-25 18:25:05 EDT
I kind of like the way logs rotate daily. Yes, mine are around 200MB per day, but it's not a big deal.

I would prefer if logs were automatically removed after, say, a week, but that's fine.
Comment 5 sonu 2014-01-31 02:07:57 EST
For us server log getting created daily is around 2 GB.
Is there any way ,we could add max file size limit?If yes ,that would be great.
Comment 6 Libor Zoubek 2014-03-03 06:25:58 EST
Sonu, 

it's just a matter of configuring logging on your RHQ Server. You can do it via RHQ UI. Navigate to your RHQ Server => logging resource, create "Size Rotating File Handler" called eg X. Then go to RHQ Server => logging's configuration tab and add X to handlers list and remove FILE from handlers list. Then you need to restart your RHQ Server.
Comment 7 Stian Lund 2014-03-03 08:05:36 EST
Hello Libor,
well my point was that this should be default. I.e the user/operator should not need to think about the log files slowly filling the disks unless some job is setup to remove old files.

And there really shouldn't be need to go into RHQ for every new install and setup a proper logger.

For instance 'sonu' says 2GB/day. This is a *lot* for a virtual server where maybe the /opt disk is 10GB like for us.

So size-rotating logs should always be the default, it's just "best practice" ;)

Note You need to log in before you can comment on or make changes to this bug.