1

I was trying to set compression for jboss log files. The log files I want to compress are console.log and server.log. Compression for console.log is working fine, but server.log I am seeing issues. I am using logrotate for using compression . Please find my rules below .

$cat /etc/logrotate.d/jboss 
 /data/logs/*/console.log
 /data/logs/*/server.log {
 daily
 rotate 14
 copytruncate
 compress
 missingok
 postrotate
  # Service restarts go here.
 endscript

}

log files are named as follows

-rw-rw-r--  1 jboss logs      139 Dec 21 03:23 console.log-20151221.gz
-rw-rw-r--  1 jboss logs 12195934 Dec 21 23:59 server.log.2015-12-21
-rw-rw-r--  1 jboss logs     1383 Dec 22 03:40 console.log-20151222.gz
-rw-rw-r--  1 jboss logs 12157917 Dec 22 23:59 server.log.2015-12-22
-rw-rw-r--  1 jboss logs     1037 Dec 23 03:32 console.log-20151223.gz
-rw-rw-r--  1 jboss logs 11966496 Dec 23 23:59 server.log.2015-12-23
-rw-rw-r--  1 jboss logs      142 Dec 24 03:10 console.log-20151224.gz
-rw-rw-r--. 1 jboss logs      113 Dec 24 12:27 console.log
-rw-rw-r--  1 jboss logs  8730030 Dec 24 17:35 server.log

Please suggest .

1

jboss is rotating the log server.log itself. You can see the different timestamps on the logs where console.log is rotated around 3.10am and server.log around midnight. Also the filename notation differ. If you want to use compression, I suggest to disable rotation within jboss and to use logrotate instead.

  • I am using logrotate itself . Compression is working for console.log but not for server.log . there is .gz extension for console.log files. – Zama Ques Dec 25 '15 at 0:54
  • You 'configured' logrotate for both but logrotate only get its 'hands' on console.log. server.log is being rotated by jboss before logrotate can do its job. – Lambert Dec 25 '15 at 15:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.