Current time: 04-19-2024, 01:40 PM Hello There, Guest! (LoginRegister)


Post Reply 
[SOLVED] logrotate does not compress rotated file
Author Message
Wut Offline
Junior Member
*

Posts: 18
Joined: Aug 2007
Reputation: 0
Post: #1
[SOLVED] logrotate does not compress rotated file
I use ispcp1.0.0 on Debian Lenny 32bit

I run it on VPS so I get only 10GB space and I have some trouble with logs file size. So I have to edit /etc/logrotate.conf to rotate log everyday and compress it.

PHP Code:
# see "man logrotate" for details
# rotate log files weekly
daily

# keep 4 weeks worth of backlogs
rotate 90

# create new (empty) log files after rotating old ones
create

# uncomment this if you want your log files compressed
compress

# packages drop log rotation information into this directory
include /etc/logrotate.d

# no packages own wtmp, or btmp -- we'll rotate them here
/var/log/wtmp {
    
missingok
    monthly
    create 0664 root utmp
    rotate 1
}

/var/
log/btmp {
    
missingok
    monthly
    create 0660 root utmp
    rotate 1
}

# system-specific logs may be configured here 

After I edit it, log was rotated but not compress. So my HDD problem still effect anyway T_T.

Any suggestion will be appreciated,
(This post was last modified: 04-03-2009 05:19 AM by BeNe.)
03-29-2009 02:42 PM
Find all posts by this user Quote this message in a reply
BeNe Offline
Moderator
*****
Moderators

Posts: 5,899
Joined: Jan 2007
Reputation: 68
Post: #2
RE: logrotate does not compress rotated file
But in the logrotate config that comes with ispCP we compress the Logfiles
--> /etc/logrotate.d/ispcp/
Code:
/var/log/apache2/users/*.log {
  weekly
  missingok
  rotate 52
  compress
  delaycompress
  notifempty
  create 640 root adm
  sharedscripts
  prerotate
    /var/www/ispcp/engine/traffic/ispcp-vrl-traff > /var/log/ispcp/ispcp-vrl-traff.log
  endscript
  postrotate
    /etc/init.d/apache2 reload > /dev/null
  endscript
}

/var/log/apache2/backup/*.log.perv {
  size 5M
  missingok
  rotate 5
  compress
  delaycompress
  notifempty
  create 640 root adm
}

/var/log/proftpd/xferlog {
  daily
  rotate 7
  missingok
  compress
  delaycompress
  postrotate
    if [ -e /var/run/syslogd.pid ]; then
      /usr/bin/killall -HUP syslogd
    elif [ -e /var/run/rsyslogd.pid ]; then
      /usr/bin/killall -HUP rsyslogd
    fi
  endscript
}

/var/log/proftpd/ftp_traff.log {
  daily
  rotate 7
  missingok
  compress
  delaycompress
  prerotate
    /var/www/ispcp/engine/traffic/ispcp-vrl-traff > /var/log/ispcp/ispcp-vrl-traff.log
  endscript
  postrotate
    if [ -e /var/run/syslogd.pid ]; then
      /usr/bin/killall -HUP syslogd
    elif [ -e /var/run/rsyslogd.pid ]; then
      /usr/bin/killall -HUP rsyslogd
    fi
  endscript
}
So for the ispCP files this should work.
Why did you set 90 instead of 4 Weeks ?

Geez BeNe
03-30-2009 03:56 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Wut Offline
Junior Member
*

Posts: 18
Joined: Aug 2007
Reputation: 0
Post: #3
RE: logrotate does not compress rotated file
Sorry, look like it's my misunderstanding.

I change it in /etc/logrotate.d/ispcp and /etc/logrotate.d/apache2 and it's work.
04-03-2009 01:52 AM
Find all posts by this user Quote this message in a reply
BeNe Offline
Moderator
*****
Moderators

Posts: 5,899
Joined: Jan 2007
Reputation: 68
Post: #4
RE: logrotate does not compress rotated file
Fine! No Problem.

Greez BeNe
04-03-2009 05:18 AM
Visit this user's website Find all posts by this user Quote this message in a reply
vetch101 Offline
Junior Member
*

Posts: 45
Joined: May 2007
Reputation: 0
Post: #5
RE: logrotate does not compress rotated file
(04-03-2009 05:18 AM)BeNe Wrote:  Fine! No Problem.

Greez BeNe

Hi all,

I've just run out of space on my 10GB VPS and I noticed that all my log files are enormous... (e.g. mail.log and mail.log.prev are 575MB)

I don't seem to have any rotations going on at all...

I installed initially from an RC... 2 or 3, I think, and I'm currently running on RC6. Did the logrotate setup only start working after RC6?

How would I check to see for definite that it's not rotating?

Many thanks,

Jx
(07-10-2009 08:02 PM)vetch101 Wrote:  
(04-03-2009 05:18 AM)BeNe Wrote:  Fine! No Problem.

Greez BeNe

Hi all,

I've just run out of space on my 10GB VPS and I noticed that all my log files are enormous... (e.g. mail.log and mail.log.prev are 575MB)

I don't seem to have any rotations going on at all...

I installed initially from an RC... 2 or 3, I think, and I'm currently running on RC6. Did the logrotate setup only start working after RC6?

How would I check to see for definite that it's not rotating?

Many thanks,

Jx

Ok - I've just checked... error.log in apache seems to be rotating and gzipping, but mail.* certainly isn't...
Any recommendations for best practice on that?

Cheers,

Jx
(This post was last modified: 07-10-2009 08:13 PM by vetch101.)
07-10-2009 08:02 PM
Find all posts by this user Quote this message in a reply
vetch101 Offline
Junior Member
*

Posts: 45
Joined: May 2007
Reputation: 0
Post: #6
RE: [SOLVED] logrotate does not compress rotated file
OK - so I've looked at it...
In the /etc/logrotate.d/ folder, there is a sendmail file which is all commented out...
And a syslog.bastille file which is empty...

Currently, my mail.info, mail.log and mail.log.prov are all around 5-600MB, as is my syslog file, and auth.log is 120MB.
The log rotation for apache and the other services seem to be working...

Whilst I'm using postfix (clearly), should I be uncommenting the sendmail log rotation file?

Also, is there a good syslog logrotation file that I could use?

Finally, will it screw things up with these massive log files when I run the logrotation for the first time?

Many thanks,

Jx
07-10-2009 10:48 PM
Find all posts by this user Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)