LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > AIX
User Name
Password
AIX This forum is for the discussion of IBM AIX.
eserver and other IBM related questions are also on topic.

Notices

Reply
 
Search this Thread
Old 04-10-2008, 07:39 AM   #1
gbratig
LQ Newbie
 
Registered: Jun 2006
Posts: 14

Rep: Reputation: 0
Logrotate: compress logs in a temp directory


Hello, somebody know how can i configure the logrotate to make this compress a file into a temporal file in the tmp directory and then move it in the original directory again?

Thanks

Last edited by gbratig; 04-10-2008 at 08:01 AM.
 
Old 04-11-2008, 04:50 PM   #2
blacky_5251
Member
 
Registered: Oct 2004
Location: Adelaide Hills, South Australia
Distribution: RHEL 4&5, Fedora 10, CentOS 5.4, IPCop
Posts: 569

Rep: Reputation: 55
You'll need to check with your man pages, but my logrotate has an option named "compresscmd" that will let you specify the command to use when compressing the log file.

My guess is you could write a script that moved the logfile (probably parameter $1 to your script) and compress it elsewhere before moving it back again.

There is also the "compressoptions" setting which might let you specify parameters to your default compression program that will tell it to use an alternate directory as a work area.
 
Old 04-12-2008, 11:06 AM   #3
gbratig
LQ Newbie
 
Registered: Jun 2006
Posts: 14

Original Poster
Rep: Reputation: 0
Ian, thanks for the reply, i check those flags that you say, but i cant found the way to do that logrotate compress in other directory, also i try with option oldir, oldir /tmp, but dosn't work, cause the dest dir, must be in the same device, i try do a link, but, no way. Do you have any idea to use the options that you said? to compress in other directory. Thanks.

P.S.: man page is my friend, the problem is that there isn't too much documentation about logrotate, specially, how to use correctly the options that it have. for example what you can do with prerotate, postrotate, etc..
 
Old 04-12-2008, 10:42 PM   #4
blacky_5251
Member
 
Registered: Oct 2004
Location: Adelaide Hills, South Australia
Distribution: RHEL 4&5, Fedora 10, CentOS 5.4, IPCop
Posts: 569

Rep: Reputation: 55
I've not done this myself, so you need to test it at your end with your op/sys. I would write a script that takes the name of the logfile as a parameter ($1), and moves the file to an alternate location where you then compress it. Then move it back to its original position in compressed state.

In your /etc/logrotate.conf file, set the compresscmd option to your script name.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
compress a directory using tar muskiediver Linux - General 4 07-18-2006 10:24 AM
how to copy-in cpio archive to temp directory jxi Slackware 2 03-08-2006 04:32 PM
How does MLDonkey's 'temp' directory work? Aeiri Linux - General 0 06-12-2004 12:53 AM
how to compress a directory? hughgjohnson Linux - Newbie 1 11-14-2003 03:15 PM
Deleting temp install directory? Ed-Slack Linux - General 1 01-05-2003 09:06 AM


All times are GMT -5. The time now is 08:09 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration