Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Rotating/Trimming Log Files

Posted on 1998-04-29
2
Medium Priority
?
295 Views
Last Modified: 2006-11-17
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
Comment
Question by:WVBoy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 2

Accepted Solution

by:
jaked earned 800 total points
ID: 2006549
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
 

Author Comment

by:WVBoy
ID: 2006550

0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello fellow BSD lovers, I've created a patch process for patching openjdk6 for BSD (FreeBSD specifically), although I tried to keep all BSD versions in mind when creating my patch. Welcome to OpenJDK6 on BSD First let me start with a little …
Introduction Regular patching is part of a system administrator's tasks. However, many patches require that the system be in single-user mode before they can be installed. A cluster patch in particular can take quite a while to apply if the machine…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Suggested Courses

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question