Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

logrotating?

Status
Not open for further replies.

blueeyedme

Technical User
Nov 27, 2002
39
NL
Hi folks :)

On our system we have a huge directory with alot of *.log files. I would like to make some sort of logrotate script. Some sort of thing that checks if a logfile is older then 10 days, and if so tar it with all the other 10 day old .log files and name the tarfile as logfiles.weeknr.

Anybody ?
 
Untested :
find /logdir -name "*.log" -mtime +10 -exec tar -cvf tarfile {} \;

HTH
Dickie Bird (:)-)))
 
I think if i use it the "Dickie Bird" way ;) its gonna create separate tar files for every logfile?

jeroen
 
That is correct blueeyedme. This modified version would create one archive (untested):
Code:
find /logdir -name "*.log" -mtime +10 | xargs tar -czf logs.`date +%V`.tgz
//Daniel
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top