You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Dan Santner <da...@me.com> on 2013/07/30 22:51:55 UTC

is it safe to delete the log file?

I know that sounds silly but....I've done that kind of thing before and really regretted it afterwards.  So I'm asking you all.  Can I simply whack the couch.log file and trust that couch will handle that gracefully?  

I've been using the same couchdb process for over a year now (maybe restarted it like 4 times) locally and noticed my log file is over 2G!

Thanks, 
Dan.

Re: is it safe to delete the log file?

Posted by Dan Santner <da...@me.com>.
Thanks guys.  Glad I asked!  cat /dev/null did the trick.

On Jul 30, 2013, at 4:17 PM, Robert Newson <rn...@apache.org> wrote:

> couchdb won't close the file descriptor, so be sure to use
> 'copytruncate' option with logrotate.
> 
> B.
> 
> 
> On 30 July 2013 22:08, Jim Klo <ji...@sri.com> wrote:
>> when you built/installed couchdb… there should be a logrotated config file
>> that was generated somewhere that you either need to link or copy into
>> /etc/logrotate.d/couchdb:
>> 
>> Here's the template file:
>> https://github.com/apache/couchdb/blob/master/etc/logrotate.d/couchdb.tpl.in
>> 
>> you could probably just cut/paste and update the contents of this (which is
>> just the path to your couchdb log directory) straight into
>> /etc/logrotate.d/...
>> 
>> also the safest way to truncate just about any log file is:
>> 
>> sudo cat /dev/null > /path/to/your/logfile.log
>> 
>> As it doesn't confuse any existing open file handles usually…
>> 
>> This is all assuming you are running on some Linux variant.
>> 
>> 
>> - JK
>> 
>> Jim Klo
>> Senior Software Engineer
>> Center for Software Engineering
>> SRI International
>> t. @nsomnac
>> 
>> On Jul 30, 2013, at 1:51 PM, Dan Santner <da...@me.com>
>> wrote:
>> 
>> I know that sounds silly but....I've done that kind of thing before and
>> really regretted it afterwards.  So I'm asking you all.  Can I simply whack
>> the couch.log file and trust that couch will handle that gracefully?
>> 
>> I've been using the same couchdb process for over a year now (maybe
>> restarted it like 4 times) locally and noticed my log file is over 2G!
>> 
>> Thanks,
>> Dan.
>> 
>> 


Re: is it safe to delete the log file?

Posted by Robert Newson <rn...@apache.org>.
couchdb won't close the file descriptor, so be sure to use
'copytruncate' option with logrotate.

B.


On 30 July 2013 22:08, Jim Klo <ji...@sri.com> wrote:
> when you built/installed couchdb… there should be a logrotated config file
> that was generated somewhere that you either need to link or copy into
> /etc/logrotate.d/couchdb:
>
> Here's the template file:
> https://github.com/apache/couchdb/blob/master/etc/logrotate.d/couchdb.tpl.in
>
> you could probably just cut/paste and update the contents of this (which is
> just the path to your couchdb log directory) straight into
> /etc/logrotate.d/...
>
> also the safest way to truncate just about any log file is:
>
> sudo cat /dev/null > /path/to/your/logfile.log
>
> As it doesn't confuse any existing open file handles usually…
>
> This is all assuming you are running on some Linux variant.
>
>
> - JK
>
> Jim Klo
> Senior Software Engineer
> Center for Software Engineering
> SRI International
> t. @nsomnac
>
> On Jul 30, 2013, at 1:51 PM, Dan Santner <da...@me.com>
>  wrote:
>
> I know that sounds silly but....I've done that kind of thing before and
> really regretted it afterwards.  So I'm asking you all.  Can I simply whack
> the couch.log file and trust that couch will handle that gracefully?
>
> I've been using the same couchdb process for over a year now (maybe
> restarted it like 4 times) locally and noticed my log file is over 2G!
>
> Thanks,
> Dan.
>
>

Re: is it safe to delete the log file?

Posted by Jim Klo <ji...@sri.com>.
when you built/installed couchdb… there should be a logrotated config file that was generated somewhere that you either need to link or copy into /etc/logrotate.d/couchdb:

Here's the template file:
https://github.com/apache/couchdb/blob/master/etc/logrotate.d/couchdb.tpl.in

you could probably just cut/paste and update the contents of this (which is just the path to your couchdb log directory) straight into /etc/logrotate.d/... 

also the safest way to truncate just about any log file is:

	sudo cat /dev/null > /path/to/your/logfile.log

As it doesn't confuse any existing open file handles usually…

This is all assuming you are running on some Linux variant.


- JK

Jim Klo
Senior Software Engineer
Center for Software Engineering
SRI International
t.	@nsomnac

On Jul 30, 2013, at 1:51 PM, Dan Santner <da...@me.com>
 wrote:

> I know that sounds silly but....I've done that kind of thing before and really regretted it afterwards.  So I'm asking you all.  Can I simply whack the couch.log file and trust that couch will handle that gracefully?  
> 
> I've been using the same couchdb process for over a year now (maybe restarted it like 4 times) locally and noticed my log file is over 2G!
> 
> Thanks, 
> Dan.


Re: is it safe to delete the log file?

Posted by thanos <th...@gmail.com>.
The usual safe  idiom is to:

cat /dev/null >  your_log_file


On Tue, Jul 30, 2013 at 4:51 PM, Dan Santner <da...@me.com> wrote:

> I know that sounds silly but....I've done that kind of thing before and
> really regretted it afterwards.  So I'm asking you all.  Can I simply whack
> the couch.log file and trust that couch will handle that gracefully?
>
> I've been using the same couchdb process for over a year now (maybe
> restarted it like 4 times) locally and noticed my log file is over 2G!
>
> Thanks,
> Dan.