Unix/Linux Go Back    


UNIX and Linux Applications Discuss UNIX and Linux software applications. This includes SQL, Databases, Middleware, MOM, SOA, EDA, CEP, BI, BPM and similar topics.

Logrotate with catalina.out "daily compressed file is overwriting the logs"

UNIX and Linux Applications


Tags
linux and unix, logrotate problem, solved, tomcat log

Closed    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 01-08-2016
thiyagoo thiyagoo is offline
Registered User
 
Join Date: Jul 2009
Last Activity: 10 January 2017, 2:13 AM EST
Posts: 5
Thanks: 3
Thanked 0 Times in 0 Posts
Logrotate with catalina.out "daily compressed file is overwriting the logs"

Hi Everyone,

We are trying to do a logrotate for "catalina.out" daily, So have used the "copytruncate" option in the logrotate configuration but ended up seeing there was a 0kb file touched with "catalina.out" and the other file with the current date(compressed) file created and seems the log is writing to it as below.

The expected behavior is the log should be written to "catalina.out" and there should not be a today dated compressed file that is getting written. Can someone please suggest..

Config:

Code:
/var/log/tomcat/catalina.out {
    copytruncate
    daily
    rotate 7
    compress
    missingok
}


Code:
Log file:
-rw-rw-r-- 1 tomcat www 139K Dec 21 03:39 catalina.out-20151220.gz
-rw-rw-r-- 1 tomcat www  20K Jan  5 06:48 catalina.out-20160105.gz
-rw-rw-r-- 1 tomcat www 3.9K Jan  6 03:11 catalina.out-20160106.gz
-rw-rw-r-- 1 tomcat www  11K Jan  7 03:43 catalina.out-20160107.gz
-rw-rw-r-- 1 tomcat www 2.9K Jan  8 03:41 catalina.out-20160108.gz   ----- it's getting updated here & it should have not been compressed today..
-rw-rw-r-- 1 tomcat www    0 Jan  8 03:41 catalina.out  ----- Expecting this file to be updated
 logrotate.d]$ date
Fri Jan  8 06:41:34 CST 2016

Moderator's Comments:
Logrotate with catalina.out "daily compressed file is overwriting the logs" Please use code tags.

-
Thiyags.

Last edited by jim mcnamara; 01-08-2016 at 08:38 AM..
Sponsored Links
    #2  
Old Unix and Linux 01-08-2016
Don Cragun's Unix or Linux Image
Don Cragun Don Cragun is offline Forum Staff  
Administrator
 
Join Date: Jul 2012
Last Activity: 23 September 2017, 6:14 PM EDT
Location: San Jose, CA, USA
Posts: 10,508
Thanks: 542
Thanked 3,675 Times in 3,135 Posts
I fail to see your logic. It would appear that sometime between 3 and 7 am every morning, the current log file is closed, renamed (adding the current date to the name) and compressed, and a new catalina.out log file is created.

There is no indication that anything has been added to the renamed and compressed log file (catalina.out-20160108.gz) after the log was rotated since the renamed compress log file and the new log file both have the same date stamp. Since the daily compressed log files are all under 140Kb, it does not appear that the uncompressed log files are "big". You have given us no indication of when the file listing you showed us was made. But, there is no indication that anything has been written to either of these files since catalina.out was last rotated at 3:41 in the morning on the 8th of January.
The Following User Says Thank You to Don Cragun For This Useful Post:
thiyagoo (01-11-2016)
Sponsored Links
    #3  
Old Unix and Linux 01-11-2016
thiyagoo thiyagoo is offline
Registered User
 
Join Date: Jul 2009
Last Activity: 10 January 2017, 2:13 AM EST
Posts: 5
Thanks: 3
Thanked 0 Times in 0 Posts
Hi Don,

Thanks for your valuable response, Am doing a testing with the test boxes so there will no flow in logs here. Also once we succeed with our other testings then we will implement along this into our production servers.

And yes now i have waited to watch the changes, And am pretty ok with this logrotation stuff. Once again thanks for clearing the dark.

Now:


Code:
 -rw-rw-r-- 1 tomcat www  12M Dec 22 03:07 catalina.out-20151222
-rw-rw-r-- 1 tomcat www  12K Jan  6 03:09 catalina.out-20160106.gz
-rw-rw-r-- 1 tomcat www 2.1K Jan  7 03:29 catalina.out-20160107.gz
-rw-rw-r-- 1 tomcat www 2.2K Jan  8 03:36 catalina.out-20160108.gz
-rw-rw-r-- 1 tomcat www 1.9K Jan  9 03:29 catalina.out-20160109.gz
-rw-rw-r-- 1 tomcat www  229 Jan 10 03:28 catalina.out-20160110.gz
-rw-rw-r-- 1 tomcat www  86K Jan 11 00:02 catalina.out
[uxadmin@ds6-testa-er-1 datasite]$ date
Mon Jan 11 01:46:16 CST 2016
]$

-
Thiyags

Last edited by thiyagoo; 01-11-2016 at 02:56 AM..
Sponsored Links
Closed

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Using "mailx" command to read "to" and "cc" email addreses from input file asjaiswal UNIX for Dummies Questions & Answers 2 10-11-2014 09:32 PM
awk command to replace ";" with "|" and ""|" at diferent places in line of file shis100 Shell Programming and Scripting 7 03-16-2011 08:59 AM
catalina.sh : need combination from "start" and "run" Filly Shell Programming and Scripting 1 02-08-2008 03:21 AM
Does "gzip" have a no prompt option on it for overwriting if file exists? LordJezo UNIX for Dummies Questions & Answers 1 07-29-2004 09:39 AM
"looping" compressed file exile UNIX for Dummies Questions & Answers 1 08-29-2001 09:00 AM



All times are GMT -4. The time now is 02:37 AM.