Solved

Rotating/Trimming Log Files

Posted on 1998-04-29
2
272 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 200 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

Technology Partners: 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

I have been running these systems for a few years now and I am just very happy with them.   I just wanted to share the manual that I have created for upgrades and other things.  Oooh yes! FreeBSD makes me happy (as a server), no maintenance and I al…
Why Shell Scripting? Shell scripting is a powerful method of accessing UNIX systems and it is very flexible. Shell scripts are required when we want to execute a sequence of commands in Unix flavored operating systems. “Shell” is the command line i…
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…
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

749 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