LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   AIX (https://www.linuxquestions.org/questions/aix-43/)
-   -   Logrotate: compress logs in a temp directory (https://www.linuxquestions.org/questions/aix-43/logrotate-compress-logs-in-a-temp-directory-634389/)

gbratig 04-10-2008 07:39 AM

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

blacky_5251 04-11-2008 04:50 PM

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.

gbratig 04-12-2008 11:06 AM

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..

blacky_5251 04-12-2008 10:42 PM

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.


All times are GMT -5. The time now is 12:22 AM.