Seva,

I thought about something like that. One complication is that it's not just the 
wtmpx log. I left others out for simplicity. The approach you suggest would 
require a similar regex check for each log.

One approach that came to mind this morning when discussing this with a 
colleague would be to use a module. I could write a Perl script that can do 
much more powerful regex checking than Cfengine can natively and then specify a 
class to define if the desired parameters don't match the existing logadm.conf 
entry. Also, since modules are a bit heavier weight than using native 
capabilities, and since the logadm file doesn't change often anyway, I could 
just restrict the command promise to only check maybe once per hour, at most.

I'm going to investigate this approach, but if anyone has any further 
suggestions, or even critiques of using a module for this, please speak up. :)

Thanks,
Justin

-----Original Message-----
From: Seva Gluschenko [mailto:seva.glusche...@gmail.com] 
Sent: Thursday, May 27, 2010 12:01 AM
To: Justin Lloyd
Cc: help-cfengine@cfengine.org
Subject: Re: Managing Solaris logadm.conf

Justin,

perhaps, you shouldn't insist on exact match. It seems to be
sufficient to match vital parts of string you want to maintain, e.g.

classes:
   "must_be_changed" not => regcmp(".*-C 3.*-c.*-p 1m.*", "$(args)");

2010/5/26 Justin Lloyd <jll...@digitalglobe.com>:
> I'm trying to decide how best to manage certain entries in Solaris
> /etc/logadm.conf files. Initially, I'm just trying to ensure that
> /var/adm/wtmpx is being rotated correctly. However, there are a couple
> of catches in trying to manage this file.
>
> 1. The file is generally maintained through the logadm(1M) command, so
> that would imply that commands promises would be better than files
> promises. However...
>
> 2. Whenever logadm rotates a file, it adds an option to the file's entry
> to record the last rotation time for the file. For example, a new wtmpx
> entry like
>
>   /var/adm/wtmpx -C 3 -c -p 1m
>
> might become
>
>   /var/adm/wtmpx -C 3 -P 'Sat May  8 03:10:00 2010' -c -p 1m
>
> The location of the "-P 'timestamp'" option does not appear
> deterministic. This complicates trying to determine whether the wtmpx
> entry is correct. For example, say I have a bundle to which I pass a
> filename a list of options:
>
>   "wtmpx" usebundle => _rotate_solaris_log("/var/adm/wtmpx", "-C 3 -c
> -p 1m");
>
> In the bundle, I see if there is already an entry that begins with
> /var/adm/wtmpx. If not, I add it. If so, I leave it alone. However,
> if/when I want to change the rotation parameters (say, changing "-p 1m"
> to "-p 1w"), an exact match against the parameter string won't work
> because of the added -P flag, and I'd like to avoid changing the line
> EVERY time Cfengine runs.
>
> Any thoughts that I might not have considered yet on how to approach
> managing this file? Note that the parameters for wtmpx, for example, may
> vary based on classes.
>
> Thanks,
> Justin
>
> --
> Justin C. Lloyd
> Unix Infrastructure Engineer
> DigitalGlobe, An Imaging and Information Company
>
>
>
> This electronic communication and any attachments may contain confidential 
> and proprietary
> information of DigitalGlobe, Inc. If you are not the intended recipient, or 
> an agent or employee
> responsible for delivering this communication to the intended recipient, or 
> if you have received
> this communication in error, please do not print, copy, retransmit, 
> disseminate or
> otherwise use the information. Please indicate to the sender that you have 
> received this
> communication in error, and delete the copy you received. DigitalGlobe 
> reserves the
> right to monitor any electronic communication sent or received by its 
> employees, agents
> or representatives.
>
> _______________________________________________
> Help-cfengine mailing list
> Help-cfengine@cfengine.org
> https://cfengine.org/mailman/listinfo/help-cfengine
>



-- 
SY, Seva Gluschenko.

This electronic communication and any attachments may contain confidential and 
proprietary 
information of DigitalGlobe, Inc. If you are not the intended recipient, or an 
agent or employee 
responsible for delivering this communication to the intended recipient, or if 
you have received 
this communication in error, please do not print, copy, retransmit, disseminate 
or 
otherwise use the information. Please indicate to the sender that you have 
received this 
communication in error, and delete the copy you received. DigitalGlobe reserves 
the 
right to monitor any electronic communication sent or received by its 
employees, agents 
or representatives.

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

Reply via email to