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/22 10:08] 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 27: Línea 27:
  
 Para crear la tarea programa en el cron podemos hacerlo de dos formas  Para crear la tarea programa en el cron podemos hacerlo de dos formas 
 +
 ** Mediante crontab ** ** Mediante crontab **
-> #crontab -e  
  
 +> #crontab -e 
 +<file>
 # Rotar logs con logrotate a las 3 am  # Rotar logs con logrotate a las 3 am 
-0 03 * * * root /usr/sbin/logrotate /etc/logrotate.conf > /dev/null 2>&+0 03 * * * root /usr/sbin/logrotate /etc/logrotate.conf > /dev/null 2>&</file>
  
 ** Por un script ** ** 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  mejor aún sería crear un script dentro cron.diary llamado, por ejemplo, logrotate para que se ejecute todos los días 
  
-/etc/cron.daily/logrotate +<code>nano /etc/cron.daily/logrotate</code> 
- $ cat /etc/cron.daily/logrotate+<file>
 #!/bin/sh #!/bin/sh
  
Línea 46: Línea 49:
 fi fi
 exit 0 exit 0
 +</file>
  
 ==== Referencias ==== ==== Referencias ====
Línea 51: Línea 55:
   * 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