Visualizzazione dei risultati da 1 a 5 su 5
  1. #1

    Mantenere i log per un mese

    Ciao!

    Ho un server in cui gira Apache. L'obiettivo è di tenere i log che genera per un mese!

    Per ora sembra tenere solo quelli di 4 giorni! Infatti in /var/log/httpd/ sono presenti i file (notare la data):
    ... Jun 21 11:24 access
    ... Jun 21 04:15 access.1.gz
    ... Jun 20 04:00 access.2.gz
    ... Jun 19 04:19 access.3.gz
    ... Jun 18 04:04 access.4.gz

    Dove e come devo mettere mano?

    Grazie
    Ciao

  2. #2

    Re: Mantenere i log per un mese

    Originariamente inviato da daviweb

    [...]Dove e come devo mettere mano?
    logrotate, direi.
    Vedi man logrotate.conf
    "Qualsiasi esperto ha paura di combattere usando la katana vera. Anch'io. Ma non ignoro la mia paura, riesco ad accettarla, e a metterla da parte accanto a me".

  3. #3
    Questa è una parte di /etc/logrotate.conf
    codice:
    # see "man logrotate" for details
    # rotate log files weekly
    weekly
    
    # keep 4 weeks worth of backlogs
    rotate 4
    
    ...
    
    # RPM packages drop log rotation information into this directory
    include /etc/logrotate.d
    
    ...
    Poi nella directory /etc/logrotate.d, il file apache contiene:
    codice:
    /var/log/httpd/access {
        daily
        prerotate
            rm -rf /home/tmp/.logrotate_apache_access >/dev/null 2>&1
            cp /var/log/httpd/access /home/tmp/.logrotate_apache_access >/dev/null 2>&1
        endscript
        missingok
        postrotate
            /bin/kill -HUP `cat /var/run/httpd.pid 2>/dev/null` 2> /dev/null || true
            /usr/local/sbin/split_logs web < /home/tmp/.logrotate_apache_access
            rm -f /home/tmp/.logrotate_apache_access >/dev/null 2>&1
        endscript
    }

    Non capisco dove posso impostare di tenere i log un mese...

  4. #4

  5. #5
    [QUOTE]Originariamente inviato da daviweb
    [B]Questa è una parte di /etc/logrotate.conf
    codice:
    # see "man logrotate" for details
    # rotate log files weekly
    weekly
    Qui metti monthly

    codice:
    /var/log/httpd/access {
        daily
    Anche qui.
    Poi se logrotate e` attivato periodicamente da cron/anacron (come solitamente avviene), fallo partire ogni mese anziche` ogni settimana
    "Qualsiasi esperto ha paura di combattere usando la katana vera. Anch'io. Ma non ignoro la mia paura, riesco ad accettarla, e a metterla da parte accanto a me".

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.