The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
.
google unix.com



UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
logrotate with /etc/logrotate.conf file skmdu UNIX for Advanced & Expert Users 2 10-17-2009 07:04 AM
logrotate isn't rotating files any longer manouche UNIX for Advanced & Expert Users 1 06-17-2009 04:21 PM
logrotate question manouche UNIX for Advanced & Expert Users 1 01-29-2009 02:38 AM
logrotate bug? jjinno UNIX for Advanced & Expert Users 0 06-09-2008 04:24 PM
Disabling logrotate primal UNIX for Dummies Questions & Answers 2 04-14-2008 01:19 PM

Reply
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 4 Weeks Ago
renuka renuka is offline
Registered User
  
 

Join Date: Sep 2009
Posts: 11
Post how to logrotate log files

Hi,
I have written a script that runs every five minutes in cron schedular. The Operating system is Fedora core 9. This script generates 2 log files, these log file size is increasing as some log data is being dumped into these 2 log files every five minutes. I need to logrotate these 2 files. Could someone help me with the steps to configure logrotate for the 2 files?
Thanks in advance
  #2 (permalink)  
Old 4 Weeks Ago
icefalcon icefalcon is offline
Registered User
  
 

Join Date: Oct 2009
Posts: 3
re: how to logrotate files

If you have logrotate installed (chances are you do) then there should be a few files in /etc/logrotate.d that you can look at to give examples of how to use logrotate to do daily log rotations. The format is fairly straighforward - the names of the files to be rotated, follwed by a list of configuration options in {}. The /etc/logrotate.conf file contains system wide defaults.

Look at the man pages (man logrotate) to find out what the options mean and pay particular attention to the 'create' and 'copytruncate' sections. Since your script is running out of cron you likely don't need to worry about signaling it to start a new log file, however you will want to be careful about what would happen if logrotate runs at the same time as your script.

Logrotate itself is called by cron once per day so if you need more frequent log rotation you'll need to set that up manually. You can look at the /etc/crontab file to find out when the scripts in /etc/cron.daily folder are going to be run. (That's where logrotate is called)

Cheers,
Anthony
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 07:58 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0