meta data de esta página
  •  

Diferencias

Muestra las diferencias entre dos versiones de la página.

Enlace a la vista de comparación

Ambos lados, revisión anteriorRevisión previa
Próxima revisión
Revisión previa
linux:logrotate [2012/02/06 13:32] lclinux:logrotate [2023/01/18 14:10] (actual) – editor externo 127.0.0.1
Línea 7: Línea 7:
 <file>  <file> 
 #directorio donde están los logs de la aplicación  #directorio donde están los logs de la aplicación 
-"/home/tomcat/des/logs/*.log" +/home/tomcat/des/logs/*.log 
-"/home/tomcat/pre/logs/*.log"+/home/tomcat/pre/logs/*.log
 { {
  weekly  weekly
Línea 25: Línea 25:
 Para forzar la ejecución <code>logrotate -f /etc/logrotate.d/rotar_logs</code> Para forzar la ejecución <code>logrotate -f /etc/logrotate.d/rotar_logs</code>
  
 +
 +Para crear la tarea programa en el cron podemos hacerlo de dos formas 
 +
 +** Mediante crontab **
 +
 +> #crontab -e 
 +<file>
 +# Rotar logs con logrotate a las 3 am 
 +0 03 * * * root /usr/sbin/logrotate /etc/logrotate.conf > /dev/null 2>&1 </file>
 +
 +** Por un script **
 +
 +mejor aún sería crear un script dentro cron.diary llamado, por ejemplo, logrotate para que se ejecute todos los días 
 +
 +<code>nano /etc/cron.daily/logrotate</code>
 +<file>
 +#!/bin/sh
 +
 +/usr/sbin/logrotate /etc/logrotate.conf
 +EXITVALUE=$?
 +if [ $EXITVALUE != 0 ]; then
 +    /usr/bin/logger -t logrotate "ALERT exited abnormally with [$EXITVALUE]"
 +fi
 +exit 0
 +</file>
  
 ==== Referencias ==== ==== Referencias ====
-// http://rm-rf.es/como-configurar-logrotate-sistemas-red-hat/ +  * http://rm-rf.es/como-configurar-logrotate-sistemas-red-hat/ 
-// http://lifeonubuntu.com/configuring-log-rotation-of-apache2-and-other-logs/ +  http://lifeonubuntu.com/configuring-log-rotation-of-apache2-and-other-logs/ 
-// http://www.thegeekstuff.com/2010/07/logrotate-examples/+  http://www.thegeekstuff.com/2010/07/logrotate-examples/ 
 +  * http://articles.slicehost.com/2010/6/30/understanding-logrotate-on-centos-part-1 
 +  * http://articles.slicehost.com/2010/6/30/understanding-logrotate-on-centos-part-2