Re: can't rotate logs

2012-07-20 Thread Chris Davies
DragonDon  wrote:
> I have setup logrotate and forgot to setup the cron job.  Part of my
> troubleshooting was to run it manually but I get a bunch of permission
> errors http://paste.debian.net/179771/.

The relevant ones are these (which it would have been more helpful to
paste here) -

$ sudo /usr/sbin/logrotate -f /etc/logrotate.conf
error: error creating output file /var/log/exim4/mainlog.1.gz: File exists
error: error creating output file /var/log/fail2ban.log.1.gz: File exists
...
error: error creating output file /var/log/messages.1.gz: File exists
error: error creating output file /var/log/tor/log.1.gz: File exists


> I was running it manually with 'sudo  /usr/sbin/logrotate -f
> /etc/logrotate.conf'

The reasons for these errors are not at all obvious until you have come
across them once before. Take the exim4 error as a worked example. The
process is (very approximately) this -

1. rename mainlog to mainlog.1
2. create a new empty mainlog
3. compress mainlog.1 (to mainlog.1.gz)

What happens here is that the compression code finds that mainlog.1.gz
already exists, so it cannot (will not) overwrite it while compressing
mainlog.1. Instead, it stops with a "File exists" error.

You can try this for yourself like this -

date > date.txt
gzip date.txt
date > data.txt
gzip date.txt

The solution in each of the error instances is to decide which of X and
X.gz you want to keep, as you can't have both.

Chris


-- 
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/rvgnd9xvo6@news.roaima.co.uk



Re: can't rotate logs

2012-07-19 Thread Camaleón
On Thu, 19 Jul 2012 22:22:40 +0900, DragonDon wrote:

> I have setup logrotate and forgot to setup the cron job.  

Mmm, I don't recall that's needed :-?

> Part of my troubleshooting was to run it manually but I get a bunch of
> permission errors http://paste.debian.net/179771/.

I think permission errors were because you first run the command as a 
plain user. 

And these:

dragondon@FireBreather:~$ sudo /usr/sbin/logrotate -f /etc/logrotate.conf
error: error creating output file /var/log/exim4/mainlog.1.gz: File exists
error: error creating output file /var/log/fail2ban.log.1.gz: File exists
error: error creating output file /var/log/syslog.1.gz: File exists
error: error creating output file /var/log/daemon.log.1.gz: File exists
error: error creating output file /var/log/kern.log.1.gz: File exists
error: error creating output file /var/log/auth.log.1.gz: File exists
error: error creating output file /var/log/user.log.1.gz: File exists
error: error creating output file /var/log/debug.1.gz: File exists
error: error creating output file /var/log/messages.1.gz: File exists
error: error creating output file /var/log/tor/log.1.gz: File exists

I also guess that's the expected when the archived files already exist.

> I was running it manually with 'sudo  /usr/sbin/logrotate -f
> /etc/logrotate.conf'
> 
> Help?

It's not clear to me what's the problem here :-?

Greetings,

-- 
Camaleón


-- 
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/ju9f3f$nho$1...@dough.gmane.org



can't rotate logs

2012-07-19 Thread DragonDon
I have setup logrotate and forgot to setup the cron job.  Part of my
troubleshooting was to run it manually but I get a bunch of permission
errors http://paste.debian.net/179771/.

I was running it manually with 'sudo  /usr/sbin/logrotate -f
/etc/logrotate.conf'

Help?


-- 
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: 
http://lists.debian.org/CAAh+W0Ct+KDfWJvmO=xvplty8wcrg5hgdvqw-87zbvvh7uw...@mail.gmail.com