[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Is it possible to do this using logrotate?

Does the logrotate process you run have enough permissions to write to
the file it's trying to truncate?  It seems to have enough permissions
to copy it, but not to write it.  Check to see if you as a user can
write to the file since my logrotate command has no suid bit set.


On 10 Aug 2001 15:46:34 -0400, Steve McWilliams wrote:
> >Steve McWilliams <stevemc@Radix.Net> writes:
> >
> >> I wonder if anyone has experience with the logrotate utility and can
> >> answer a question about it for me.  After reading the man page discussion
> >> about a copytruncate option, it sounded like it was somehow possible
> >> to copy off a log file and truncate it to length 0, and allow the
> >> logging process to continue unaffected.
> >> 
> >> After trying this however the behavior I'm seeing is that the log is
> >> copied off, and the logging process is able to continue writing to
> >> the same file descriptor, but the log is not correctly truncated.
> >
> >How is it failing exactly?
> If I have the following logrotate config file for instance:
> /tmp/foo.log {
>     rotate 5
>     size=1k
>     copytruncate
> }
> I have a process which is appending to this file frequently.  When
> the log file has exceeded 1k I manually invoke logrotate.  It copies
> /tmp/foo.log to /tmp/foo.log.1 as expected, however the size and 
> contents of the original /tmp/foo are unaffected.  The /tmp/foo file
> continues to grow in size and is never truncated.  What I expected to 
> see according to the documentation was /tmp/foo reset to 0 size and 
> grow from there.
> >> I realize this isn't strictly speaking a debian question, so I apologize
> >> in advance if this isn't the correct forum for this question.
> >
> >Anyway, debian-mentor is for packaging-related questions, so it would
> >be more appropriate to debian-user. So please heed the reply-to.
> >
> >-- 
> >Robbe
> I see.  I just tried subscribing to this list but got a bounce for some
> reason.  I'll try to post questions like this there in future though.
> Thanks,
> Steve
> -- 
> To UNSUBSCRIBE, email to debian-user-request@lists.debian.org 
> with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

Reply to: