logrotate bug?


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users logrotate bug?
# 1  
Old 06-09-2008
logrotate bug?

I have been mailing myself logs for a while, but just ran into a problem because of a process that cannot HUP its log. (I realize thats why they implemented the "copytruncate" option in the first place)

When I use logrotate with "copytruncate" and "compress" there is a problem. The "myScript" log is rotated to "myScript.1", at which point the "postrotate" directives are executed, and finally the "myScript.1" file is gzipped.

My problem is that I am relying on the "postrotate" stuff to send me the gzipped log. I do this for all my other HUP-able logs, and it works fine. The problem as I see it is that logrotate thinks it's done rotating as soon as it has created the .1 file. However, since I am not controlling the compression, but logrotate IS, the compression should also be considered part of the "rotation"... Unfortunately, since I am looking for a .1.gz file, and it doesnt exist as of the postrotate arguments, I cant send it.

I made an attempt at removing the compress option from logrotate, and putting the gzipping in my postrotate arguments, but that went south too. The problem is that when the next rotation happens, logrotate expects to see a .1 file, doesnt, and so doesnt rotate it to .2... when the original is rolled to the .1, and I then gzip it, it fails to overwrite the .1.gz file that already exists.

I realize that I could put N lines of "if .N exists, rotate to .N+1" in my prerotate arguments, but that seems like a pathetic workaround.

Any ideas?
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. AIX

Logrotate - /etc/logrotate.conf does't exist

Hi Admins. I have installed logrotate rpm on Aix 6.1. After the installation of rpm, I don't find /etc/logrotate.conf file and /etc/logrotate.d dir . The config file is located in /opt/freeware/etc/logrotate.conf. When I ran logrotate -v /opt/freeware/etc/logrotate.conf I get below... (2 Replies)
Discussion started by: snchaudhari2
2 Replies

2. Shell Programming and Scripting

Logrotate - I am not able to rotate files using logrotate

I have written script which is working in Home directory perfectly and also compressing log files and rotating correctly. But, when i try to run script for /var/log/ i am able to get compressed log files but not able to get rotation of compressed log files. Please suggest. I am using below command... (5 Replies)
Discussion started by: VSom007
5 Replies

3. SuSE

Which logs to logrotate?

Hi all We've had new servers coming in and one of the requirement was to keep logs for up to 8 months. I know logrotate can do the job, but by default (on Suse Enterprise10, 11) we have these logs in /etc/logrotate.d dir as default logs which are rotated: -rw-r--r-- 1 root root 140 Jul... (0 Replies)
Discussion started by: hedkandi
0 Replies

4. Red Hat

Logrotate on RHEL 5

Hi All, Can any one let me me know if i run /usr/sbin/logrotate /etc/logrotate.conf will it read the whole /var/log/messages or it just see the time stamp of message file & then rotate the logs. Just wants to know is logrotation based on messages file contents or messages file time stamp. ... (1 Reply)
Discussion started by: ajaincv
1 Replies

5. Linux

Logrotate every 15days

Hi all, I have been asked to configure logrotate for a perticular log file for every 15 days. I do not find options other than weekly or monthly.Need you expertise on the same:confused: (0 Replies)
Discussion started by: iron_michael86
0 Replies

6. UNIX for Dummies Questions & Answers

How to test logrotate?

I want to test whether logrotate will rotate my log file or not? (1 Reply)
Discussion started by: proactiveaditya
1 Replies

7. Linux

LogRotate

Hi I am trying to rotate specific log by using logrotate function in unix I have made following entry in the /etc/logrotate.conf file /var/log/testlog/debug_log { daily rotate 7 create compress } But only issue is that my other logs like /var/log/messages,... (2 Replies)
Discussion started by: SiddhV
2 Replies

8. UNIX for Advanced & Expert Users

logrotate with /etc/logrotate.conf file

Hi there, I want to rotate the logfiles which are located in /var/log/jboss/tomcat* so I have created a file named as 'tomat' in /etc/logrotate.d/tomcat with the following content. # cat /etc/logrotate.d/tomcat /var/log/jboss/tomcat_access_log*.log { daily nocreate ... (2 Replies)
Discussion started by: skmdu
2 Replies

9. UNIX for Advanced & Expert Users

logrotate.conf

I changed the logrotate.conf file to make a new log file to be automatically rotated daily. But after a night, I have not seen the rotated file. When does this rotation happen? I mean what is the exact time? In addition, do I have to restart what deamon to make the change take effect? (10 Replies)
Discussion started by: fredao
10 Replies
Login or Register to Ask a Question