SV: [asterisk-users] Manage 'full' log file

Ex Vitorino ex.vitorino at gmail.com
Mon Jan 8 18:59:43 MST 2007


On 1/8/07, lenz <lenz-ml at oinko.net> wrote:
>
> You know that if you rename an open Unix file, it will stay open - i.e. if
> you rename the logfile "full" to "full.1", Asterisk will continue writing
> to "full.1" thinking it was "full".
> The "logger rotate" command forces all log files to be closed and reopened
> with their canonical names, so your file is actually rotated.
> Hope this helps
> l.
>

  CORRECT about UNIX files, INCORRECT about "logger rotate" command.

  CORRECTION:

  "logger rotate" does:

  1. Closes the files
  2. Renames them (actually rotating them)
  3. Reopnes the canonical named files

  "logger reload" does effectively work as you described:

  1. Closes files
  2. Reopens canonical named files

  This is the command that should be used with logrotate, for
  example.


  EXAMPLE: (consider asterisk running and writing to messages file)

  # cd /var/log/asterisk
  # mv messages messages.old

  (asterisk still running and now writing to messages.old)
  (there is no file named messages)

  # /usr/sbin/asterisk -rx "logger reload"

  (asterisk closed messages.old and created a new messages file)


  Hope this is clear enough as its really late now...
  Please correct me if I'm wrong

  Cheers
--
  Ex Vito


More information about the asterisk-users mailing list