logrotate
Ian Coetzee
ubuntu at iancoetzee.za.net
Thu Mar 4 09:43:40 UTC 2010
On 2010/03/04 11:27 AM, Kaushal Shriyan wrote:
> On Thu, Mar 4, 2010 at 2:33 PM, Amedee Van Gasse (ub)
> <amedee-ubuntu at amedee.be> wrote:
>
>> On Thu, March 4, 2010 09:41, Kaushal Shriyan wrote:
>>
>>> Hi,
>>>
>>> is there a way to scp or rsync the files to a remote host older than
>>> 15 days in the logrotate config ?
>>>
>> Yes, of course!
>> Just add your scp or rsync stanza to the postrotate section of your
>> logrotate config. man logrotate or google 'logrotate postrotate' for
>> examples.
>>
>> --
>> Amedee
>>
> Amedee,
>
> Let me rephrase the question.
>
> Is there a way to scp or rsync the files to a remote host older than
> 15 days in the logrotate config and than delete it on localhost older
> than 15 days, so that at a time only 15 days of logs are available on
> localhost. ?
>
> Thanks,
>
> Kaushal
>
>
The only way I can think of is using a cronjob calling a "find" script
on a daily basis.
Should look something like this (Note my "find" is a bit rusty, so dont
take my code as gospel)
>for FILE in `find /var/log/ -atime +15
>do
> <insert magic here to do something with $FILE>
>done
Use "man find" to fine the correct syntax :)
Regards
Ian
More information about the ubuntu-users
mailing list