• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 297
  • Last Modified:

Rotating/Trimming Log Files

I want to make a copy of all log files on my servers and then tar and compress them to tape. After this, I would like to trim the log files down. Question--while running a command to trim the files, how do you account for the possibility that the log file(s) could still be written to (since these log files could have open processes). Isn't it possible that even in this fraction of a second that the trim command is taking place and zeroing out the log file, your system could be trying to log new entries that may go into the bit bucket. In a secure system, this could be critical information lost.
0
WVBoy
Asked:
WVBoy
1 Solution
 
jakedCommented:
The way this is usually dealt with is to rename the log file (the server still has an open filehandle to it after the rename, so it can keep writing to it), and then SIGHUP or otherwise restart the server so that it reopens its log file (since you've renamed the old one, a new one is started).

0
 
WVBoyAuthor Commented:

0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now