Then, you should do something like the following; changing the promiser to a 
parent directory and using file_select to match the file name. Haven't test but 
it should work. :-)

 files:
   "/var/cfengine"
      file_select => size_exceeds("promise\.log","1M"),
      depth_search => recurse("1"),
      rename => rotate("2");

body file_select size_exceeds(filename,filesize)
{
 leaf_name => { "$(filename)" };
 search_size => irange("$(filesize)","10M");
 file_result => "leaf_name.size";
}

Cheers,
--Nakarin

On Jun 4, 2010, at 9:38 AM, Seva Gluschenko wrote:

> Nakarin,
> 
> this way you can only define timed rotation (by means of action =>
> if_elapsed or by classes), but not size-based rotation. To define
> size-based rotation, I use file_select, but it wants depth_search from
> me. I believe, depth_search requirement must be suppressed for file
> promises.
> 
> 2010/6/4 Nakarin Phooripoom <mynameisje...@gmail.com>:
>> Do we really need to include depth_search to rotate a file?
>> 
>> file:
>>   "/var/cfengine/promise.log"
>>      rename => rotate("3");
>> 
>> Cheers,
>> --Nakarin
>> 
>> On Jun 4, 2010, at 8:46 AM, Seva Gluschenko wrote:
>> 
>>> Hello folks,
>>> 
>>> When I wrote a promise to rotate /var/cfengine/promise.log (BTW, why
>>> Cfengine doesn't rotate it?), cf-promises warned me about using rename
>>> body without depth_search body. Well, okay, despite I was surprised
>>> with such a requirement, I've added depth_search => recursion("1").
>>> Now (with 3.0.5b2), executor sends me messages with the following
>>> warning:
>>> 
>>> Warning: depth_search (recursion) is promised for a base object
>>> /var/cfengine/promise.log that is not a directory
>>> 
>>> So how do I get rid of warnings? Can depth_search be removed now or so?
>>> 
>>> --
>>> SY, Seva Gluschenko.
>>> _______________________________________________
>>> Help-cfengine mailing list
>>> Help-cfengine@cfengine.org
>>> https://cfengine.org/mailman/listinfo/help-cfengine
>> 
>> 
> 
> 
> 
> -- 
> SY, Seva Gluschenko.

_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to