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


 
Thread Tools Search this Thread
Special Forums UNIX and Linux Applications Logrotate with catalina.out "daily compressed file is overwriting the logs"
# 1  
Old 01-08-2016
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:
Mod Comment Please use code tags.

-
Thiyags.

Last edited by jim mcnamara; 01-08-2016 at 09:38 AM..
# 2  
Old 01-08-2016
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.
This User Gave Thanks to Don Cragun For This Post:
# 3  
Old 01-11-2016
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 03:56 AM..
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Bash script - Print an ascii file using specific font "Latin Modern Mono 12" "regular" "9"

Hello. System : opensuse leap 42.3 I have a bash script that build a text file. I would like the last command doing : print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt where : print_cmd ::= some printing... (1 Reply)
Discussion started by: jcdole
1 Replies

2. UNIX for Beginners Questions & Answers

"unzip" compressed security camera videos

Good afternoon, I started apologizing for not creating a specific topic with my subject, I could not find the option to create a topic, friends, if someone can help me thank you very much, I have a problem, I have a DVR with a HISILICON HI chip 3520, it compresses and encrypts the videos recorded... (2 Replies)
Discussion started by: cristopher0258
2 Replies

3. UNIX for Dummies Questions & Answers

Using "mailx" command to read "to" and "cc" email addreses from input file

How to use "mailx" command to do e-mail reading the input file containing email address, where column 1 has name and column 2 containing “To” e-mail address and column 3 contains “cc” e-mail address to include with same email. Sample input file, email.txt Below is an sample code where... (2 Replies)
Discussion started by: asjaiswal
2 Replies

4. Shell Programming and Scripting

Perl failure with "main::$fn" used only once:" in error logs

Hi all, Can anyone guess why this is happening? I am new to Perl, so please help me to fix this error: - I have a static html file which calls the cgi-perl script. HTML Code: <html> <head> <title> Hey Dude! </title> </head> <body> <form method="POST"... (3 Replies)
Discussion started by: bashily
3 Replies

5. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

6. Shell Programming and Scripting

catalina.sh : need combination from "start" and "run"

heya, can someone help me with following problem. i am not sure how far you know the catalina.sh script from tomcat. when i start my tomcat with "catalina.sh run" then the startup-process-output will be printed out on the console, but the tomcat process is started in current shell/session, so... (1 Reply)
Discussion started by: Filly
1 Replies

7. UNIX for Dummies Questions & Answers

Does "gzip" have a no prompt option on it for overwriting if file exists?

So I dont enounter things like: gzip: /sometimename.gz already exists; do you wish to overwrite (y or n)? Want to add it into a script and if there is a file aready there to just overwrite it, otherwise the script will hang unless there is manual intervention. (1 Reply)
Discussion started by: LordJezo
1 Replies

8. UNIX for Dummies Questions & Answers

"looping" compressed file

I've got a problem with a .z compressed file: when I decompress it, I get a .gz file, and when I decompress this one, I get the previous .z file again! Does anyone know how do I break off this loop? (1 Reply)
Discussion started by: exile
1 Replies
Login or Register to Ask a Question