Forum: Cfengine Help
Subject: Question regarding the rotate function and cf_Audit.db
Author: anmcguire
Link to topic: https://cfengine.com/forum/read.php?3,17769,17769#msg-17769

Hello everyone,


I'm currently in the process of deploying cfengine 3.0.3 community edition to 
several systems.  As part of my initial configuration I'm trying to get 
cfengine to manage it's own file sizes using the rotate function.  The problem 
I'm having seems to be with rotating the /var/cfengine/cf_Audit.db file.   Here 
is the code I'm using.



bundle agent cfengine
{
vars:

  "component" slist => { "cf-serverd", "cf-execd" };

processes:

  "$(component)" restart_class => canonify("start_$(component)");

commands:

  "/var/cfengine/bin/$(component)"
    ifvarclass => canonify("start_$(component)");

files:

  "/etc/inittab"
    edit_line => append_if_no_line("cf3:2345:respawn:/var/cfengine/bin/cf-execd 
--no-fork");

  Hr00.Q1::
    "/var/cfengine/cf_Audit.db"
      rename => rotate("7");
}



and the problem is that rotation seems to corrupt the file, but only for some 
systems, which makes me think that there is some sort of race condition going 
on.  Perhaps the part of rotate() that zeroes out the files does so at an 
inopportune time?  I can't be sure, but I get notifications via email that look 
something like the following:


/var/cfengine/cf_Audit.db: unexpected file type or format
Couldn't open database /var/cfengine/cf_Audit.db
 !!! System error for db_open: "Invalid argument"
DB->put: method not permitted before handle's open method
DB->put: method not permitted before handle's open method
/var/cfengine/cf_Audit.db: unexpected file type or format
Couldn't open database /var/cfengine/cf_Audit.db
 !!! System error for db_open: "Invalid argument"


Additionally, the file no longer seems to grow in size, and it's modification 
time is no longer updated.  Obviously, I'd like to be able to manage the size 
of this file using cfengine, but I'm either running into a bug, or my efforts 
are misguided.  After consulting the cfengine reference manual, it says that 
the file should be periodically "archived and deleted".  I figured rotate would 
be sufficient for this purpose.  So my questions are:


[*] Am I going about managing the size of cf_Audit.db the wrong way?
[*] If not, is this a bug in cfengine?
[*] If it is a bug, has it been fixed in a subsequent release?
[*] If it is a bug and has not been fixed in newer releases (>3.0.3), is there 
a good workaround?



Thanks in advance for any guidance you might offer.

_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to