help-cfengine
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Réf. : Re: The cfengine way of rotating files?


From: paguerlais
Subject: Réf. : Re: The cfengine way of rotating files?
Date: Thu, 6 Feb 2003 08:58:54 +0100


Hi all,

I use logrotate for most of my log rotation needs. It's simple, efficient,
and you can find it for at least Linux and Solaris.

HIH
Patrice





help-cfengine-bounces+paguerlais=airfrance.fr@gnu.org@fielden.org> le
06/02/2003 04:10:50

Envoyé par :      Joshua Fielden <jf@fielden.org>


Pour : julian_simpson@yahoo.co.uk
cc :   "'Wheeler, John'" <JWheeler@us.britannica.com>,
       help-cfengine@gnu.org

Objet :     Re: The cfengine way of rotating files?


We use a combination of cronolog and log4j for our application at work.
Our log4j.properties files have entries like this:

     <!-- APPENDERS -->
     <appender name="debuglog"
class="org.apache.log4j.DailyRollingFileAppender">
         <param name="File" value="/$app/$root/logs/$app/$app.lo
g"/>
         <param name="DatePattern" value="-yyyy-MM-dd"/>
         <param name="encoding" value="utf-8"/>
         <layout class="org.apache.log4j.PatternLayout">
             <param name="ConversionPattern" value="%d [%t] [%-5p %c]
%m%n"/>
         </layout>
     </appender>

Between the two, we get date-stamped logfiles for everything. For
system logfiles (Solaris), we use PARCdaily, part of YASSP:

http://www.yassp.org/daily.html

Our few non-solaris machines aren't mission-critical, so we leave the
system rotation to the default scheme for the platform.

Hope that helps, and isn't too far off-topic. :)

jf

On Wednesday, Feb 5, 2003, at 13:43 US/Pacific, Julian Simpson wrote:

> Hi John,
>
> Thanks for your reply.  I have looked at cronolog and it sounds
> great.  Not sure if it will work in this instance because I have a mix
> of servers - including several Java servers that use log4j and other
> methods to write logfiles - so I'm not sure I can easily get it to
> work there.
>
> I think I can work out an alternative from your example below anyhow -
> so thanks for that. I think it proves that I hadn't understood the
> cfengine approach to things :)
>
> Best,
>
> Julian.
>
>
> -----Original Message-----
> From: help-cfengine-bounces+julian_simpson=gmx.co.uk@gnu.org
> [mailto:help-cfengine-bounces+julian_simpson=gmx.co.uk@gnu.org] On
> Behalf Of Wheeler, John
> Sent: 05 February 2003 15:19
> To: help-cfengine@gnu.org
> Subject: RE: The cfengine way of rotating files?
>
> I had to do something like this recently. I ran across this
> http://www.cronolog.org/
>
> It make file creation a much easier with apache.
>
> It created the files I need in a format similar to what you described.
> The second part was moving and copying. I've included the conf files
> below.
>
> :> more yesterday.conf
> control:
>         addclasses      = ( yesterday )
>
>         _day    = ( ExecResult(/bin/sh -c "TZ=${TZ}+24;export
> TZ;/bin/date +%d") )
>         _monnum = ( ExecResult(/bin/sh -c "TZ=${TZ}+24;export
> TZ;/bin/date +%m") )
>         _month  = ( ExecResult(/bin/sh -c "TZ=${TZ}+24;export
> TZ;/bin/date +%b") )
>         _year   = ( ExecResult(/bin/sh -c "TZ=${TZ}+24;export
> TZ;/bin/date +%Y") )
>
>
> [:> more registerrotate.conf
> classes:
>         desthost        = ( app002prod )
>         register        = ( web001prod web002prod )
> import:
>         !yesterday::
>                 yesterday.conf
>
> control:
>
>         Rfilename       = ( access.$(_day)$(_month)-12AM )
>
>         Rsourcepfx      = ( /var/adm/apache/register-80/logs/access )
>         Rsourcepath     = (
> "$(Rsourcepfx)/$(_year)/$(_monnum)/$(Rfilename)" )
>
>
>         Rdestpfx1       = ( /logs/register/web001prod/access )
>         Rdestpfx2       = ( /logs/register/web002prod/access )
>         Rdestpath1      = (
> "$(Rdestpfx1)/$(_year)/$(_monnum)/$(Rfilename)" )
>         Rdestpath2      = (
> "$(Rdestpfx2)/$(_year)/$(_monnum)/$(Rfilename)" )
>
>
>         desthost::
>                 actionsequence  = (
>                         copy.registerrotate
>                 )
>         register::
>                 actionsequence  = (
>                         shellcommands.registerrotate
>                 )
>
> shellcommands:
>
>         registerrotate.Hr02_Q1::
>                 '/usr/bin/gzip $(Rsourcepath)'
>
> copy:
>
>         registerrotate.Hr03_Q1::
>                 $(Rsourcepath).gz
>                         dest=$(Rdestpath1).gz
>                         type=checksum
>                         inform=true
>                         server=web001prod
>
>                 $(Rsourcepath).gz
>                         dest=$(Rdestpath2).gz
>                         type=checksum
>                         inform=true
>                         server=web002prod
>
> I run this on the two web servers I harvest logs from, and the
> collection server I pull them to. I protect the yesterday import
> because I harvest ~ 10 different sites from a server at one time. All
> the other conf files look very similar with the macro names changed.
>
> My macro names suck because of name space collision. I haven't figured
> out a clever way to have the same macro in a template file and not
> have it collide with other names, although it sounds like name spaces
> are part of the next cfengine release.
>
> wheeler
>
> -----Original Message-----
> From: Julian Simpson [mailto:julian_simpson@yahoo.co.uk]
> Sent: Tuesday, February 04, 2003 3:51 PM
> To: help-cfengine@gnu.org
> Subject: The cfengine way of rotating files?
>
>
> Hi,
>
> I want to rotate and compress web/app server logfiles on my systems.
> I presently use cfengine for tidying directories, disting things like
> Big Brother, etc.  I am rotating some logs with disable and the
> rotate=x option, but I don't want numbered logfiles, I want a date.
>
> I think I want to:
>
> - copy the file to file.YYYY-MM-DD.
> (okay, I can do that with the copy command if I can work out a way to
> massage the date to that format)
>
> - cat /dev/null into the original file
> (disable: and then rotate=empty)
>
> - compress the copy.
> (shell command)
>
> The thing is, I only want the actions to happen if the previous
> actions completed.  And if I come up with an actionsequence of ( copy
> disable shellcommands ) and declare all the logfiles in each stanza,
> how do I do that?
>
> What I want to be able to do is a shell-like:
>
> for file in "/path/to/file1 /path/to/file2"
> do
>         filenew="$file.`date +%F`"
>         cp $file $filenew && \
>         >$file && \
>         gzip $filenew
> done
>
> Is there a way to do this in cfengine, or do I just not grok the
> cfengine approach?
>
> Best,
>
> Julian.
>
> Julian Simpson
> julian@juliansimpson.org
> http://juliansimpson.is-a-geek.org
>
> __________________________________________________
> Do You Yahoo!?
> Everything you'll ever need on one web page
> from News and Sport to Email and Music Charts http://uk.my.yahoo.com
>
>
> _______________________________________________
> Help-cfengine mailing list
> Help-cfengine@gnu.org
> http://mail.gnu.org/mailman/listinfo/help-cfengine
>
> _______________________________________________
> Help-cfengine mailing list
> Help-cfengine@gnu.org
> http://mail.gnu.org/mailman/listinfo/help-cfengine



_______________________________________________
Help-cfengine mailing list
Help-cfengine@gnu.org
http://mail.gnu.org/mailman/listinfo/help-cfengine






 
----------------
L'acces immediat aux meilleurs tarifs Air France et au billet electronique sur 
http://www.airfrance.com
 
For immediate access to the best Air France fares and to electronic tickets, 
visit our website http://www.airfrance.com
 
----------------
Les donnees et renseignements contenus dans ce message sont personnels, 
confidentiels et secrets. Ce message est adresse a l'individu ou l'entite dont 
les coordonnees figurent ci-dessus. Si vous n'etes pas le bon destinataire, 
nous vous demandons de ne pas lire, copier, utiliser ou divulguer cette 
communication. Nous vous prions de notifier cette erreur a l'expediteur et 
d'effacer immediatement cette communication de votre systeme.
The information contained in this message is privileged, confidential, and 
protected from disclosure. This message is intended for the individual or 
entity adressed herein. If you are not the intended recipient, please do not 
read, copy, use or disclose this communication to others; also please notify 
the sender by replying to this message, and then delete it from your system.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]