Log rotation using Plone

Rotating the magazine to install a Plone product would be a nice feature. What are the current best practices for integrating magazine integration in Plone?

I found this article: http://encolpe.wordpress.com/2010/06/17/how-to-get-log-files-rotate-in-zope-with-buildout/ , but since there is no documentation on plone.org I would like to drive away the community for well-known best practices so as not to fill up my hard drives.

+4
source share
5 answers

Like what Lawrence said above, but saves the size under 10mb and saves only 1 old file.

<eventlog> level INFO <logfile> path /path/to/plone4/var/log/client1.log max-size 10mb old-files 1 </logfile> </eventlog> 

plone.recipe.zope2instance can generate this now. For example, you can specify the following parameters:

 event-log-max-size = 10mb event-log-old-files = 3 
+4
source

ZConfig supports the standard RotatingFileHandler and TimedRotatingFileHandler libraries . Example from ZConfig tests:

 <eventlog> <logfile> path /path/to/file.log level debug when D interval 3 old-files 11 </logfile> </eventlog> 

This will be done through logs every three days, keeping 11 old files.

You put these configuration snippets into your assembly using the custom event-custom-custom-access-log event log options in your instance recipe. plone.recipe.zope2instance

+6
source

Here's what we do, it's simple but works:

In your composition, you will add this part:

 [logrotate] recipe = collective.recipe.template input = ${buildout:directory}/templates/logrotate.conf output = ${buildout:directory}/etc/logrotate.conf 

And in templates/logrotate.conf

 rotate 4 weekly create compress delaycompress missingok ${buildout:directory}/var/log/instance1.log ${buildout:directory}/var/log/instance1-Z2.log { sharedscripts postrotate /bin/kill -USR2 $(cat ${buildout:directory}/var/instance1.pid) endscript } ${buildout:directory}/var/log/instance2.log ${buildout:directory}/var/log/instance2-Z2.log { sharedscripts postrotate /bin/kill -USR2 $(cat ${buildout:directory}/var/instance2.pid) endscript } 

Add any other magazine twists you need. Then it's about the /etc/logrotate.conf link to the generated file.

+2
source

Mikko, you should ask me directly;)

My blog article is still good, and this feature is still undocumented in Zope2. It can be used with Plone 4 and Plone 5. The iw.rotatelogs extension is for Plone 3 only.

Using a logrotate is not normal, because it does not handle registration during rotation. This can cause your instance to crash and write logs to RAM until you restart the instance.

+2
source

I used iw.rotatezlogs since at least the early Plone 3 is very successful. I can see from your link that I no longer need iw.rotatezlogs.

I don't like relying on logrotate, as it cannot be used on the same Windows server, which I have to deploy.

As far as I can tell, the pure-zope solution (which I have not tested) does not compress the log file (at least I do not see it in ZConfig / components / logger / handlers.xml, which is where I think it should be defined ), so I suspect I will stay with iw.rotatezlogs.

+1
source

Source: https://habr.com/ru/post/1398175/


All Articles