Re: Uptime counters (was RE: [Asterisk-Users] Bayonne and Asterisk)
James Sizemore wrote: I did not even know about it! But seeing as it is not in the change log no wonder? You have the bug number the notes are under for usage? ID # 345 10/02/03 - logger_reload.diff Summary - 'logger reload' CLI command Description - Closes and reopens the log files. Good for those wanting to rotate log files. ___ Asterisk-Users mailing list [EMAIL PROTECTED] http://lists.digium.com/mailman/listinfo/asterisk-users
Re: Uptime counters (was RE: [Asterisk-Users] Bayonne and Asterisk)
You can not rotate logs with out dropping calls, and if logs get a little over 2Gbs Asterisk will crashes... So I could figure out the average time between crashs just by log level and call volume! LOL This is with out running into a single bug. smile Thankful I can restart Asterisk from time to time myself, but for a person that can not go down this would be a sticking point that would need fixing! Steven Critchfield wrote: On Tue, 2003-11-18 at 09:53, Florian Overkamp wrote: At 09:45 18-11-2003 -0500, you wrote: And yes, they can run fine together(I'm not using VOIP, just a T1 out of Asterisk to Bayonne to test and see if it would work). The IVR application that I currently still have running on Bayonne is only still on Bayonne because it can never go down, and Bayonne has proven itself to me to be extremely stable, while I cannot personally say AT THIS TIME that an Asterisk box would stay up for over 6 months with no crashes. Actually in this light it might be cute to have an 'uptime' counter inside asterisk (maybe a lastlog that can also show the reason of the last restart - was it a stop gracefully or did it just crash?) *grin* Hmm, maybe it wouldn't be much of a hack to get at the show uptime information and dump it with each log as it is sent to the events.log file so you can see if certain length runtimes cause crashes as well. Especially with respect to the post I just read about the user who has asterisk going nuts every day. I wouldn't be opposed to it being put in the CLI prompt too, or maybe just made available and then we could do something like the PS1 formatting of the prompt. ___ Asterisk-Users mailing list [EMAIL PROTECTED] http://lists.digium.com/mailman/listinfo/asterisk-users
Re: Uptime counters (was RE: [Asterisk-Users] Bayonne and Asterisk)
You can not rotate logs with out dropping calls, and if logs get a little over 2Gbs Asterisk will crashes... Why not? Why are the logfiles kept open for the entire life of Asterisk? Hell even my heavily loaded qmail server isn't this braindead in that regard. If * can be patched to open, write, close for every log write it is trivial to rotate logs: mv /path/to/logfile /path/to/logfile.old while fuser -s /path/to/logfile.old ; do sleep 1 ; done bzip2 -1 /path/to/logfile.old and you're done. mv does not change the inode, so asterisk does not notice it if it _is_ in the middle of a write, and the fuser do/while loop waits patiently until asterisk is done with the file. Next time Asterisk tries to open the file it will fail (since it doesn't exist) and will recreate it. Piece of cake. Regards, Andrew ___ Asterisk-Users mailing list [EMAIL PROTECTED] http://lists.digium.com/mailman/listinfo/asterisk-users
Re: Uptime counters (was RE: [Asterisk-Users] Bayonne and Asterisk)
Andrew Kohlsmith wrote: You can not rotate logs with out dropping calls, and if logs get a little over 2Gbs Asterisk will crashes... Why not? Why are the logfiles kept open for the entire life of Asterisk? Hell even my heavily loaded qmail server isn't this braindead in that regard. Maybe I missed part of this thread, but as of like 10/05/03 cvs there was a new app added for this called (I think) logrotate. It's supposed to allow you to send * a remote command and rotate your logs. I upgraded for this feature but have not had time to test it yet, it's on my look at list. Like I said maybe I missed part of thread but you should be able to setup a cron job and forget about it. Anybody using the logrotate app? ___ Asterisk-Users mailing list [EMAIL PROTECTED] http://lists.digium.com/mailman/listinfo/asterisk-users
Re: Uptime counters (was RE: [Asterisk-Users] Bayonne and Asterisk)
At 9:37 AM -0500 11/20/03, Andrew Kohlsmith wrote: You can not rotate logs with out dropping calls, and if logs get a little over 2Gbs Asterisk will crashes... Why not? Why are the logfiles kept open for the entire life of Asterisk? Hell even my heavily loaded qmail server isn't this braindead in that regard. If * can be patched to open, write, close for every log write it is trivial to rotate logs: mv /path/to/logfile /path/to/logfile.old while fuser -s /path/to/logfile.old ; do sleep 1 ; done bzip2 -1 /path/to/logfile.old and you're done. mv does not change the inode, so asterisk does not notice it if it _is_ in the middle of a write, and the fuser do/while loop waits patiently until asterisk is done with the file. Next time Asterisk tries to open the file it will fail (since it doesn't exist) and will recreate it. Piece of cake. Regards, Andrew Whoever said that Asterisk cannot rotate it's logfile without dropping calls was incorrect. There is a command built into Asterisk as of last month called logger reload - try: asterisk -rx logger reload See: http://bugs.digium.com/bug_view_page.php?bug_id=265 Or: From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: [Asterisk-cvs] asterisk logger.c,1.4,1.5 Date: Thu, 2 Oct 2003 02:38:59 -0400 (EDT) Update of /usr/cvsroot/asterisk In directory mongoose.digium.com:/tmp/cvs-serv31710 Modified Files: logger.c Log Message: Add logger reload CLI (bug #345) Index: logger.c === RCS file: /usr/cvsroot/asterisk/logger.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- logger.c8 Sep 2003 16:48:06 - 1.4 +++ logger.c2 Oct 2003 06:40:10 - 1.5 @@ -21,6 +21,7 @@ #include asterisk/channel.h #include asterisk/config.h #include asterisk/term.h +#include asterisk/cli.h #include string.h #include stdlib.h #include errno.h @@ -173,22 +174,22 @@ } -static struct verb { - void (*verboser)(const char *string, int opos, int replacelast, int complete); - struct verb *next; -} *verboser = NULL; - -int init_logger(void) +int reload_logger(void) { char tmp[AST_CONFIG_MAX_PATH]; + ast_mutex_lock(loglock); + if (eventlog) + fclose(eventlog); mkdir((char *)ast_config_AST_LOG_DIR, 0755); snprintf(tmp, sizeof(tmp), %s/%s, (char *)ast_config_AST_LOG_DIR, EVENTLOG); eventlog = fopen((char *)tmp, a); + ast_mutex_unlock(loglock); + if (eventlog) { init_logger_chain(); - ast_log(LOG_EVENT, Started Asterisk Event Logger\n); + ast_log(LOG_EVENT, Restarted Asterisk Event Logger\n); if (option_verbose) - ast_verbose(Asterisk Event Logger Started %s\n,(char *)tmp); + ast_verbose(Asterisk Event Logger restarted\n); return 0; } else ast_log(LOG_ERROR, Unable to create event log: %s\n, strerror(errno)); @@ -196,28 +197,55 @@ return -1; } -int reload_logger(void) +static int handle_logger_reload(int fd, int argc, char *argv[]) +{ + if(reload_logger()) + { + ast_cli(fd, Failed to reloadthe logger\n); + return RESULT_FAILURE; + } + else + return RESULT_SUCCESS; +} + +static struct verb { + void (*verboser)(const char *string, int opos, int replacelast, int complete); + struct verb *next; +} *verboser = NULL; + + +static char logger_reload_help[] = +Usage: logger reload\n + Reopens the log files. Use after a rotating the log files\n; + +static struct ast_cli_entry reload_logger_cli = + { { logger, reload, NULL }, + handle_logger_reload, Reopens the log files, + logger_reload_help }; + + +int init_logger(void) { char tmp[AST_CONFIG_MAX_PATH]; - ast_mutex_lock(loglock); - if (eventlog) - fclose(eventlog); + + /* register the relaod logger cli command */ + ast_cli_register(reload_logger_cli); + mkdir((char *)ast_config_AST_LOG_DIR, 0755); snprintf(tmp, sizeof(tmp), %s/%s, (char *)ast_config_AST_LOG_DIR, EVENTLOG); eventlog = fopen((char *)tmp, a); - ast_mutex_unlock(loglock); - if (eventlog) { init_logger_chain(); - ast_log(LOG_EVENT, Restarted Asterisk Event Logger\n); + ast_log(LOG_EVENT, Started Asterisk Event Logger\n); if (option_verbose) - ast_verbose(Asterisk Event Logger restarted\n); + ast_verbose(Asterisk Event Logger Started %s\n,(char *)tmp); return 0; } else ast_log(LOG_ERROR, Unable to create event log: %s\n, strerror(errno)); init_logger_chain(); return -1; } + extern void ast_log(int level, const char *file, int line, const char *function, const char *fmt, ...) { JT ___ Asterisk-Users mailing list [EMAIL PROTECTED] http://lists.digium.com/mailman/listinfo/asterisk-users
Re: Uptime counters (was RE: [Asterisk-Users] Bayonne and Asterisk)
What bug # should I look for you patch under? smile Andrew Kohlsmith wrote: You can not rotate logs with out dropping calls, and if logs get a little over 2Gbs Asterisk will crashes... Why not? Why are the logfiles kept open for the entire life of Asterisk? Hell even my heavily loaded qmail server isn't this braindead in that regard. If * can be patched to open, write, close for every log write it is trivial to rotate logs: mv /path/to/logfile /path/to/logfile.old while fuser -s /path/to/logfile.old ; do sleep 1 ; done bzip2 -1 /path/to/logfile.old and you're done. mv does not change the inode, so asterisk does not notice it if it _is_ in the middle of a write, and the fuser do/while loop waits patiently until asterisk is done with the file. Next time Asterisk tries to open the file it will fail (since it doesn't exist) and will recreate it. Piece of cake. Regards, Andrew ___ Asterisk-Users mailing list [EMAIL PROTECTED] http://lists.digium.com/mailman/listinfo/asterisk-users ___ Asterisk-Users mailing list [EMAIL PROTECTED] http://lists.digium.com/mailman/listinfo/asterisk-users
Re: Uptime counters (was RE: [Asterisk-Users] Bayonne and Asterisk)
I did not even know about it! But seeing as it is not in the change log no wonder? You have the bug number the notes are under for usage? [EMAIL PROTECTED] asterisk]# grep log ChangeLog -- Agent Callback-login support -- Added Dialogic VOX file format support Andrew Kohlsmith wrote: You can not rotate logs with out dropping calls, and if logs get a little over 2Gbs Asterisk will crashes... Why not? Why are the logfiles kept open for the entire life of Asterisk? Hell even my heavily loaded qmail server isn't this braindead in that regard. Maybe I missed part of this thread, but as of like 10/05/03 cvs there was a new app added for this called (I think) logrotate. It's supposed to allow you to send * a remote command and rotate your logs. I upgraded for this feature but have not had time to test it yet, it's on my look at list. Like I said maybe I missed part of thread but you should be able to setup a cron job and forget about it. Anybody using the logrotate app? ___ Asterisk-Users mailing list [EMAIL PROTECTED] http://lists.digium.com/mailman/listinfo/asterisk-users ___ Asterisk-Users mailing list [EMAIL PROTECTED] http://lists.digium.com/mailman/listinfo/asterisk-users
Uptime counters (was RE: [Asterisk-Users] Bayonne and Asterisk)
At 09:45 18-11-2003 -0500, you wrote: And yes, they can run fine together(I'm not using VOIP, just a T1 out of Asterisk to Bayonne to test and see if it would work). The IVR application that I currently still have running on Bayonne is only still on Bayonne because it can never go down, and Bayonne has proven itself to me to be extremely stable, while I cannot personally say AT THIS TIME that an Asterisk box would stay up for over 6 months with no crashes. Actually in this light it might be cute to have an 'uptime' counter inside asterisk (maybe a lastlog that can also show the reason of the last restart - was it a stop gracefully or did it just crash?) *grin* grt, Florian ___ Asterisk-Users mailing list [EMAIL PROTECTED] http://lists.digium.com/mailman/listinfo/asterisk-users
Re: Uptime counters (was RE: [Asterisk-Users] Bayonne and Asterisk)
On Tue, 2003-11-18 at 09:53, Florian Overkamp wrote: At 09:45 18-11-2003 -0500, you wrote: And yes, they can run fine together(I'm not using VOIP, just a T1 out of Asterisk to Bayonne to test and see if it would work). The IVR application that I currently still have running on Bayonne is only still on Bayonne because it can never go down, and Bayonne has proven itself to me to be extremely stable, while I cannot personally say AT THIS TIME that an Asterisk box would stay up for over 6 months with no crashes. Actually in this light it might be cute to have an 'uptime' counter inside asterisk (maybe a lastlog that can also show the reason of the last restart - was it a stop gracefully or did it just crash?) *grin* Hmm, maybe it wouldn't be much of a hack to get at the show uptime information and dump it with each log as it is sent to the events.log file so you can see if certain length runtimes cause crashes as well. Especially with respect to the post I just read about the user who has asterisk going nuts every day. I wouldn't be opposed to it being put in the CLI prompt too, or maybe just made available and then we could do something like the PS1 formatting of the prompt. -- Steven Critchfield [EMAIL PROTECTED] ___ Asterisk-Users mailing list [EMAIL PROTECTED] http://lists.digium.com/mailman/listinfo/asterisk-users
Re: Uptime counters (was RE: [Asterisk-Users] Bayonne and Asterisk)
On Tue, 2003-11-18 at 08:53, Florian Overkamp wrote: Actually in this light it might be cute to have an 'uptime' counter inside asterisk (maybe a lastlog that can also show the reason of the last restart - was it a stop gracefully or did it just crash?) *grin* Have you tried show uptime from the Asterisk CLI? Jared Smith ___ Asterisk-Users mailing list [EMAIL PROTECTED] http://lists.digium.com/mailman/listinfo/asterisk-users
Re: Uptime counters (was RE: [Asterisk-Users] Bayonne and Asterisk)
/var/log/asterisk/event_log should have the last time the server restarted. This should closely match "show uptime" result. Jared Smith wrote: On Tue, 2003-11-18 at 08:53, Florian Overkamp wrote: Actually in this light it might be cute to have an 'uptime' counter inside asterisk (maybe a lastlog that can also show the reason of the last restart - was it a stop gracefully or did it just crash?) *grin* Have you tried "show uptime" from the Asterisk CLI? Jared Smith ___ Asterisk-Users mailing list [EMAIL PROTECTED] http://lists.digium.com/mailman/listinfo/asterisk-users
Re: Uptime counters (was RE: [Asterisk-Users] Bayonne and Asterisk)
At 09:52 18-11-2003 -0700, you wrote: On Tue, 2003-11-18 at 08:53, Florian Overkamp wrote: Actually in this light it might be cute to have an 'uptime' counter inside asterisk (maybe a lastlog that can also show the reason of the last restart - was it a stop gracefully or did it just crash?) *grin* Have you tried show uptime from the Asterisk CLI? Ah very nice. I completely missed that :-) Florian ___ Asterisk-Users mailing list [EMAIL PROTECTED] http://lists.digium.com/mailman/listinfo/asterisk-users