Re: [Asterisk-Users] asterisk logger - urgent!!!

2006-02-12 Thread Bob Goddard
On Sunday 12 Feb 2006 01:04, Kevin P. Fleming wrote:
[...]
 (and by 'you' I don't mean you specifically, Michael, I am referring to
 those in this thread who think we should change the code used to write
 to every file we write to in Asterisk)

I assume you are referring to me. I did not say that.

Using write for cdr/cdr.c is perfectly feasible and as it does not
use fprintf and instead uses a fixed buffer size and would be better
served by open/write.

Please do not twist things around. You said it was impossible. Quite
clearly it is not.


B

-- 
http://www.mailtrap.org.uk/
___
--Bandwidth and Colocation provided by Easynews.com --

Asterisk-Users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [Asterisk-Users] asterisk logger - urgent!!!

2006-02-12 Thread Bob Goddard
On Sunday 12 Feb 2006 10:57, Bob Goddard wrote:
 On Sunday 12 Feb 2006 01:04, Kevin P. Fleming wrote:
 [...]

  (and by 'you' I don't mean you specifically, Michael, I am referring to
  those in this thread who think we should change the code used to write
  to every file we write to in Asterisk)

 I assume you are referring to me. I did not say that.

 Using write for cdr/cdr.c is perfectly feasible and as it does not
 use fprintf and instead uses a fixed buffer size and would be better
 served by open/write.

And that should have been cdr/cdr_csv.c  cdr/cdr_custom.c.


-- 
http://www.mailtrap.org.uk/
___
--Bandwidth and Colocation provided by Easynews.com --

Asterisk-Users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [Asterisk-Users] asterisk logger - urgent!!!

2006-02-12 Thread Warren Burstein




I agree that systems should be well-adminstered, I also prefer
programs that don't run amok even when there are lapses in
administration.

Since detecting which file caused the SIGFSZ is impractical, how about
if we do this.
a) don't rotate logs on SIGFSZ if it's done it recently.
b) when it does rotate files on SIGFSZ,. it should rotate the csv file,
too, and any other files that are written to (maybe only of they are
larger than the file size limit)

Kevin P. Fleming wrote:

  Warren Burstein wrote:
  
  
How about if it would set a global variable before each disk write so
the SIGFSZ handler would know which file caused it?

  
  
Ha!

Signals are asynchronous. This global variable would to be
lock-protected, would require copying (possibly long) paths for every
write, and would not necessarily be correct when the signal arrived.

Sorry, this is not a solution. There is no solution, other than paying
attention to your server and making sure that files don't get
ridiculously large.
  



___
--Bandwidth and Colocation provided by Easynews.com --

Asterisk-Users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [Asterisk-Users] asterisk logger - urgent!!!

2006-02-12 Thread Kevin P. Fleming
Warren Burstein wrote:

 b) when it does rotate files on SIGFSZ,. it should rotate the csv file, too, 
 and 
 any other files that are written to (maybe only of they are larger than the 
 file 
 size limit)

And there's the important point: any other files that are written to.
Asterisk writes to files all over the place... voicemail recordings,
channel monitor recordings, etc.
___
--Bandwidth and Colocation provided by Easynews.com --

Asterisk-Users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [Asterisk-Users] asterisk logger - urgent!!!

2006-02-11 Thread Bob Goddard
On Saturday 11 Feb 2006 00:10, Kevin P. Fleming wrote:
 Warren Burstein wrote:
  How about if it would set a global variable before each disk write so
  the SIGFSZ handler would know which file caused it?

 Ha!

 Signals are asynchronous. This global variable would to be
 lock-protected, would require copying (possibly long) paths for every
 write, and would not necessarily be correct when the signal arrived.

 Sorry, this is not a solution. There is no solution, other than paying
 attention to your server and making sure that files don't get
 ridiculously large.

Well, you seem to have totally ignore what I said.

Using fopen/fputs to ONLY append to a file, is quite frankly, stupid.
Change it to open/write and you will be able to trap via the write
return code and errno.


B


-- 
http://www.mailtrap.org.uk/
___
--Bandwidth and Colocation provided by Easynews.com --

Asterisk-Users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [Asterisk-Users] asterisk logger - urgent!!!

2006-02-11 Thread Kevin P. Fleming
Bob Goddard wrote:

 Using fopen/fputs to ONLY append to a file, is quite frankly, stupid.
 Change it to open/write and you will be able to trap via the write
 return code and errno.

Patches to fix bugs are most welcome. Given that these files are written
using fprintf (because they are using format strings and long lists of
arguments), using write will require allocating memory, building the
output there and then calling write(). Seems like an awful lot of work
to avoid a simple system administration failure.
___
--Bandwidth and Colocation provided by Easynews.com --

Asterisk-Users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


RE: [Asterisk-Users] asterisk logger - urgent!!!

2006-02-11 Thread Michael Collins
Perhaps there's a happy medium: sprintf()?

I am curious to know if putting the output into a char array with
sprintf() (to preserve the output formatting) and then writing it with
write().  How much additional overhead would this take?  Hard to know
without trying it.

Is anyone in a position to write some test code that would do this and
report back the results?

-MC

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Kevin P.
Fleming
Sent: Saturday, February 11, 2006 7:39 AM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: Re: [Asterisk-Users] asterisk logger - urgent!!!

Bob Goddard wrote:

 Using fopen/fputs to ONLY append to a file, is quite frankly, stupid.
 Change it to open/write and you will be able to trap via the write
 return code and errno.

Patches to fix bugs are most welcome. Given that these files are written
using fprintf (because they are using format strings and long lists of
arguments), using write will require allocating memory, building the
output there and then calling write(). Seems like an awful lot of work
to avoid a simple system administration failure.
___
--Bandwidth and Colocation provided by Easynews.com --

Asterisk-Users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users
___
--Bandwidth and Colocation provided by Easynews.com --

Asterisk-Users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [Asterisk-Users] asterisk logger - urgent!!!

2006-02-11 Thread Kevin P. Fleming
Michael Collins wrote:

 I am curious to know if putting the output into a char array with
 sprintf() (to preserve the output formatting) and then writing it with
 write().  How much additional overhead would this take?  Hard to know
 without trying it.

Please... if you don't have the skills to test things, don't make
suggestions like this.

This is _exactly_ what I was referring to earlier. How do you know what
size array is going to be large enough? Do you just allocate an enormous
one on the stack for every call to ast_log, or do you malloc() one
instead (which has serious performance issues)? You can't just 'guess'
what will be big enough, which then leads to running through the
argument list twice... There will be a non-zero cost for doing this.

Can you honestly say that _any_ of this performance penalty, no matter
how small, for every user of Asterisk on every system everywhere, is
worth the cost when the entire problem that caused this thread can be
avoided by just paying attention to your server? No log files, CDR files
or anything else in the discussion here can grow to 2GB in anything less
than a few days under normal circumstances, if not far, far longer than
that. If you can't be bothered to run logrotate or some sort of watching
process on your server, I don't think we should be force everyone else
to have lower performance just so you won't be inconvenienced :-)

(and by 'you' I don't mean you specifically, Michael, I am referring to
those in this thread who think we should change the code used to write
to every file we write to in Asterisk)
___
--Bandwidth and Colocation provided by Easynews.com --

Asterisk-Users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [Asterisk-Users] asterisk logger - urgent!!!

2006-02-10 Thread Kevin P. Fleming
Warren Burstein wrote:

 How about if it would set a global variable before each disk write so
 the SIGFSZ handler would know which file caused it?

Ha!

Signals are asynchronous. This global variable would to be
lock-protected, would require copying (possibly long) paths for every
write, and would not necessarily be correct when the signal arrived.

Sorry, this is not a solution. There is no solution, other than paying
attention to your server and making sure that files don't get
ridiculously large.
___
--Bandwidth and Colocation provided by Easynews.com --

Asterisk-Users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


[Asterisk-Users] asterisk logger - urgent!!!

2006-02-09 Thread Dov Bigio



Hi,

Since yesterday my Asterisk 1.2.3 is displaying the 
following message every few seconds

Asterisk Event Logger restartedRotated 
Logs Per SIGXFSZ (Exceeded file size limit)

This causes my log files (verbose, queue_log) to 
become huge with lots of logger rotate messages, but I don't know which files is 
exceeding size limit, since even if I delete all log files I still get this 
message.

Any way, I have plenty of disk space and couldn't 
find the reason for this message.

Please help me identify the 
issue!Dov


___
--Bandwidth and Colocation provided by Easynews.com --

Asterisk-Users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [Asterisk-Users] asterisk logger - urgent!!!

2006-02-09 Thread Tzafrir Cohen
On Thu, Feb 09, 2006 at 10:56:18AM -0200, Dov Bigio wrote:
 Hi,
 
 Since yesterday my Asterisk 1.2.3 is displaying the following message every 
 few seconds
 
 Asterisk Event Logger restarted
 Rotated Logs Per SIGXFSZ (Exceeded file size limit)
 
 This causes my log files (verbose, queue_log) to become huge with lots 
 of logger rotate messages, but I don't know which files is exceeding 
 size limit, since even if I delete all log files I still get this message.

Unrelated to the origin of the problem:

Do you run 'logger reload' after deleting those logs? Otherwise Asterisk
still writes to the old (deleted) logs

 
 Any way, I have plenty of disk space and couldn't find the reason for this 
 message.
 
 Please help me identify the issue!
 Dov
 

 ___
 --Bandwidth and Colocation provided by Easynews.com --
 
 Asterisk-Users mailing list
 To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users


-- 
Tzafrir Cohen | [EMAIL PROTECTED] | VIM is
http://tzafrir.org.il |   | a Mutt's  
[EMAIL PROTECTED] |   |  best
ICQ# 16849755 |   | friend

___
--Bandwidth and Colocation provided by Easynews.com --

Asterisk-Users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [Asterisk-Users] asterisk logger - urgent!!!

2006-02-09 Thread Dov Bigio
Hi Tzafrir,

The problem was the file Master.csv that had reached 2.0GB.
I am writing a cron script to backup this file periodically and prevent this
from happening.

Any way, if any developers are reading this, I don't think that rotating
asterisk logs is the best way to handle this problem!
Maybe a more user-friendly message could be logged, infoming which file
reached the 2.0GB.

About your question, yes I do, for log files. Is logger rotate could also
after I delete csv files?

Thank you
Dov

- Original Message - 
From: Tzafrir Cohen [EMAIL PROTECTED]
To: Dov Bigio [EMAIL PROTECTED]; Asterisk Users Mailing List -
Non-Commercial Discussion asterisk-users@lists.digium.com
Sent: Thursday, February 09, 2006 11:42 AM
Subject: Re: [Asterisk-Users] asterisk logger - urgent!!!


 On Thu, Feb 09, 2006 at 10:56:18AM -0200, Dov Bigio wrote:
  Hi,
 
  Since yesterday my Asterisk 1.2.3 is displaying the following message
every few seconds
 
  Asterisk Event Logger restarted
  Rotated Logs Per SIGXFSZ (Exceeded file size limit)
 
  This causes my log files (verbose, queue_log) to become huge with lots
  of logger rotate messages, but I don't know which files is exceeding
  size limit, since even if I delete all log files I still get this
message.

 Unrelated to the origin of the problem:

 Do you run 'logger reload' after deleting those logs? Otherwise Asterisk
 still writes to the old (deleted) logs

 
  Any way, I have plenty of disk space and couldn't find the reason for
this message.
 
  Please help me identify the issue!
  Dov
 

  ___
  --Bandwidth and Colocation provided by Easynews.com --
 
  Asterisk-Users mailing list
  To UNSUBSCRIBE or update options visit:
 http://lists.digium.com/mailman/listinfo/asterisk-users


 -- 
 Tzafrir Cohen | [EMAIL PROTECTED] | VIM is
 http://tzafrir.org.il |   | a Mutt's
 [EMAIL PROTECTED] |   |  best
 ICQ# 16849755 |   | friend





___
--Bandwidth and Colocation provided by Easynews.com --

Asterisk-Users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [Asterisk-Users] asterisk logger - urgent!!!

2006-02-09 Thread Tzafrir Cohen
On Thu, Feb 09, 2006 at 11:56:02AM -0200, Dov Bigio wrote:
 Hi Tzafrir,
 
 The problem was the file Master.csv that had reached 2.0GB.
 I am writing a cron script to backup this file periodically and prevent this
 from happening.
 
 Any way, if any developers are reading this, I don't think that rotating
 asterisk logs is the best way to handle this problem!
 Maybe a more user-friendly message could be logged, infoming which file
 reached the 2.0GB.

This should be the job of the log rotate script. Limit its size to 1 GB
and rotate it weekly. see logrotate.conf(5) . Part of just about any linux 
distro. Normally run in the daily cron.

 
 About your question, yes I do, for log files. Is logger rotate could also
 after I delete csv files?

Anybody?

-- 
Tzafrir Cohen | [EMAIL PROTECTED] | VIM is
http://tzafrir.org.il |   | a Mutt's  
[EMAIL PROTECTED] |   |  best
ICQ# 16849755 |   | friend

___
--Bandwidth and Colocation provided by Easynews.com --

Asterisk-Users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [Asterisk-Users] asterisk logger - urgent!!!

2006-02-09 Thread Kevin P. Fleming
Dov Bigio wrote:

 Any way, if any developers are reading this, I don't think that rotating
 asterisk logs is the best way to handle this problem!
 Maybe a more user-friendly message could be logged, infoming which file
 reached the 2.0GB.

Unfortunately when we receive SIGFSZ from the kernel, we have no way to
know which file caused it. The assumption in Asterisk is that the only
files we write to that will ever reach that size are log files. If any
other file does, there will be trouble, as you have seen.
___
--Bandwidth and Colocation provided by Easynews.com --

Asterisk-Users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [Asterisk-Users] asterisk logger - urgent!!!

2006-02-09 Thread Bob Goddard
On Thursday 09 Feb 2006 16:01, Kevin P. Fleming wrote:
 Dov Bigio wrote:
  Any way, if any developers are reading this, I don't think that rotating
  asterisk logs is the best way to handle this problem!
  Maybe a more user-friendly message could be logged, infoming which file
  reached the 2.0GB.

 Unfortunately when we receive SIGFSZ from the kernel, we have no way to
 know which file caused it. The assumption in Asterisk is that the only
 files we write to that will ever reach that size are log files. If any
 other file does, there will be trouble, as you have seen.

Why use fputs which give you no indication of the type of error
when the raw write does?


B

-- 
http://www.mailtrap.org.uk/
___
--Bandwidth and Colocation provided by Easynews.com --

Asterisk-Users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [Asterisk-Users] asterisk logger - urgent!!!

2006-02-09 Thread Dov Bigio
Hi Kevin,

I see...

That's why you rotate asterisk logs everytime this message occurs.. it makes
sense.

Unfortunately, in my case, it was the CDR CSV files tha reached that size,
so rotating logs was just worsening my situation, since asterisk started to
generate rotated log files every few seconds because of that.

Is there a way to rotate CDR CSV files via Asterisk, or should I handle this
outside Asterisk?

Thanks!
Dov

- Original Message - 
From: Kevin P. Fleming [EMAIL PROTECTED]
To: Asterisk Users Mailing List - Non-Commercial Discussion
asterisk-users@lists.digium.com
Sent: Thursday, February 09, 2006 2:01 PM
Subject: Re: [Asterisk-Users] asterisk logger - urgent!!!


 Dov Bigio wrote:

  Any way, if any developers are reading this, I don't think that rotating
  asterisk logs is the best way to handle this problem!
  Maybe a more user-friendly message could be logged, infoming which file
  reached the 2.0GB.

 Unfortunately when we receive SIGFSZ from the kernel, we have no way to
 know which file caused it. The assumption in Asterisk is that the only
 files we write to that will ever reach that size are log files. If any
 other file does, there will be trouble, as you have seen.
 ___
 --Bandwidth and Colocation provided by Easynews.com --

 Asterisk-Users mailing list
 To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users




___
--Bandwidth and Colocation provided by Easynews.com --

Asterisk-Users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [Asterisk-Users] asterisk logger - urgent!!!

2006-02-09 Thread Kevin P. Fleming
Dov Bigio wrote:

 Is there a way to rotate CDR CSV files via Asterisk, or should I handle this
 outside Asterisk?

As another reply already mentioned, no and yes :-)
___
--Bandwidth and Colocation provided by Easynews.com --

Asterisk-Users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [Asterisk-Users] asterisk logger - urgent!!!

2006-02-09 Thread Matt Florell
As of Asterisk 1.2, a Master.csv file is also created in the
cdr-custom directory by default. I had a horrible time until I figured
that out. Any reason this was done by default that two Master.csv
files are created(cdr-csv/ and cdr-custom/)?

MATT---

On 2/9/06, Dov Bigio [EMAIL PROTECTED] wrote:
 Hi Kevin,

 I see...

 That's why you rotate asterisk logs everytime this message occurs.. it makes
 sense.

 Unfortunately, in my case, it was the CDR CSV files tha reached that size,
 so rotating logs was just worsening my situation, since asterisk started to
 generate rotated log files every few seconds because of that.

 Is there a way to rotate CDR CSV files via Asterisk, or should I handle this
 outside Asterisk?

 Thanks!
 Dov

 - Original Message -
 From: Kevin P. Fleming [EMAIL PROTECTED]
 To: Asterisk Users Mailing List - Non-Commercial Discussion
 asterisk-users@lists.digium.com
 Sent: Thursday, February 09, 2006 2:01 PM
 Subject: Re: [Asterisk-Users] asterisk logger - urgent!!!


  Dov Bigio wrote:
 
   Any way, if any developers are reading this, I don't think that rotating
   asterisk logs is the best way to handle this problem!
   Maybe a more user-friendly message could be logged, infoming which file
   reached the 2.0GB.
 
  Unfortunately when we receive SIGFSZ from the kernel, we have no way to
  know which file caused it. The assumption in Asterisk is that the only
  files we write to that will ever reach that size are log files. If any
  other file does, there will be trouble, as you have seen.
  ___
  --Bandwidth and Colocation provided by Easynews.com --
 
  Asterisk-Users mailing list
  To UNSUBSCRIBE or update options visit:
 http://lists.digium.com/mailman/listinfo/asterisk-users
 
 


 ___
 --Bandwidth and Colocation provided by Easynews.com --

 Asterisk-Users mailing list
 To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users

___
--Bandwidth and Colocation provided by Easynews.com --

Asterisk-Users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [Asterisk-Users] asterisk logger - urgent!!!

2006-02-09 Thread Warren Burstein

Kevin P. Fleming wrote:

Dov Bigio wrote:
  

Any way, if any developers are reading this, I don't think that rotating
asterisk logs is the best way to handle this problem!
Maybe a more user-friendly message could be logged, infoming which file
reached the 2.0GB.



Unfortunately when we receive SIGFSZ from the kernel, we have no way to
know which file caused it. The assumption in Asterisk is that the only
files we write to that will ever reach that size are log files. If any
other file does, there will be trouble, as you have seen.
  
How about if it would set a global variable before each disk write so 
the SIGFSZ handler would know which file caused it?

___
--Bandwidth and Colocation provided by Easynews.com --

Asterisk-Users mailing list
To UNSUBSCRIBE or update options visit:
  http://lists.digium.com/mailman/listinfo/asterisk-users