Old:Configurare un server Syslog su Debian: differenze tra le versioni

Riga 101: Riga 101:
# <tt>delaycompress</tt>: non comprime i log del giorno prima.
# <tt>delaycompress</tt>: non comprime i log del giorno prima.
# <tt>notifempty</tt>: non esegue la rotazione se il file è vuoto. Alternativa: ifempty
# <tt>notifempty</tt>: non esegue la rotazione se il file è vuoto. Alternativa: ifempty
# <tt>create xx user group</tt>:  
# <tt>create xx user group</tt>: imposta proprietario, gruppo e permessi per i nuovi files creati
          o If we have to create the new file give it the given mode, owner, and group.
# <tt>sharedscripts</tt> esegue ogni script di prerotate o postrotate su ogni file. Alternativa: nosharedscripts
    * sharedscripts
# <tt>postrotate + endscript</tt>: ogni cosa tra queste due voci viene eseguita dopo il processo di rotazione. Alternativa: prerotate
          o Run any given prerotate or postrotate script for each logfile individually. Opposite: nosharedscripts.
    * postrotate + endscript
          o Anything between these is executed after the rotation process. Opposite : prerotate
 
 
The upshot of this script is that any file which matches /var/log/apache2/*.log is rotated every week, compressed, if it's non-empty. The new file is created with the file mode of 640, and after the rotation has finished the server is restarted.
 
If we wish to install a local service which creates a logfile we can cause it to be rotated very easily, just by adding a new logrotate configuration file.
 
 
Assuming we have a new service "web" which produces its output in /var/log/web/output.log we can cause this to be rotated every day with a script like this:
 
 
/var/log/web/*.log {
 
  daily
 
  missingok
 
  rotate 7
 
  compress
 
  delaycompress
 
  create 640 web web
 
  sharedscripts
 
    /etc/init.d/web restart
 
  endscript
 
}
 
 
This will:
 
    * Run daily.
    * Keep no more than 7 days worth of logfiles at any one time.
    * Not complain if there is a logfile missing.
    * Compress the older files, but not yesterdays.
    * Create the new logfiles as being owned by the user and group fred.
    * Restart the service after rotating the logfiles.
 
Default /etc/logrotate.conf file as follows
 
# see "man logrotate" for details
 
# rotate log files weekly
 
weekly
 
# keep 4 weeks worth of backlogs
 
rotate 4
 
# create new (empty) log files after rotating old ones
 
create
 
# uncomment this if you want your log files compressed
 
#compress
 
# packages drop log rotation information into this directory
 
include /etc/logrotate.d
 
# no packages own wtmp, or btmp -- we'll rotate them here
 
/var/log/wtmp {
 
    missingok
 
    monthly
 
    create 0664 root utmp
 
    rotate 1
 
}
 
/var/log/btmp {
 
    missingok
 
    monthly
 
    create 0664 root utmp
 
    rotate 1
 
}
 
# system-specific logs may be configured here


===Configurazione dei client della rete===
===Configurazione dei client della rete===