Find the answer to your Linux question:
Results 1 to 2 of 2
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Log rotation without restarting the application

    Is there any way you guys on the forums know how to do logrotation without requiring a restart of the application that is doing the logging?

  2. #2
    Trusted Penguin Irithori's Avatar
    Join Date
    May 2009
    Some options:
    - The application might be able to do logrotation on its own
    - the application at least has a signalhandler, which will cause it to release the handle of the logfile and open another one
    - the application can log to a pipe. Apache is an example. Then tools like managelogs or cronolog can be used to deal with logs.
    - Not really a good way: One could copy the logfile, and after that cat /dev/null >logfile.
    The application doesnt need a restart and it will happily continue writing to the filehandle.
    But the copied logfile might not contain the latest lines.
    You must always face the curtain with a bow.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts