+ Responder ao Tópico



  1. #1
    Moderador Avatar de xandemartini
    Ingresso
    Nov 2005
    Localização
    Espumoso, Brazil
    Posts
    2.410
    Posts de Blog
    1

    Padrão Logrotate e access.log...

    Bom pessoal, posso dizer que pesquisei bastante e não encontrei resposta adequada, por isso estou postando... Meu access.log está perto de 2 giga, cerca de 10 dias de idade... queria que o logrotate incluisse esse arquivo, mantendo ele semanal e arquivando compactado os ultimos 5 por exemplo... Bom, o logrotate ja ta rodando, criei o arquivo squid dentro de /etc/logrotate.d com o seguinte conteudo (achei ele nas pesquisas na net)

    /var/log/squid/access.log {
    weekly
    rotate 5
    copytruncate
    compress
    notifempty
    missingok
    }
    /var/log/squid/cache.log {
    weekly
    rotate 5
    copytruncate
    compress
    notifempty
    missingok
    }

    /var/log/squid/store.log {
    weekly
    rotate 5
    copytruncate
    compress
    notifempty
    missingok
    # This script asks squid to rotate its logs on its own.
    # Restarting squid is a long process and it is not worth
    # doing it just to rotate logs
    postrotate
    /usr/sbin/squid -k rotate
    endscript
    }


    mas ele não faz o rotate... o que posso estar errando?

    o logrotate ta dentro do /etc/cron.daily com o seguinte conteúdo:

    #!/bin/sh
    /usr/sbin/logrotate /etc/logrotate.conf


    e o conteúdo do logrotate.conf é:

    # /etc/logrotate.conf
    #
    # logrotate is designed to ease administration of systems that generate large
    # numbers of log files. It allows automatic rotation, compression, removal, and
    # mailing of log files. Each log file may be handled daily, weekly, monthly, or
    # when it grows too large.
    #
    # logrotate is normally run daily from root's crontab.
    #
    # For more details, see "man logrotate".

    # rotate log files weekly:
    #weekly
    daily

    # 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

    # some packages install log rotation information in this directory:
    include /etc/logrotate.d

    # Rotate /var/log/wtmp:
    /var/log/wtmp {
    monthly
    create 0664 root utmp
    rotate 1
    }

    # Note that /var/log/lastlog is not rotated. This is intentional, and it should
    # not be. The lastlog file is a database, and is also a sparse file that takes
    # up much less space on the drive than it appears.

    # system-specific logs may be also be configured below:

    Onde estou errando??

  2. #2

    Padrão

    try this..

    /var/log/squid/*.log {
    daily
    compress
    delaycompress
    rotate 5
    missingok
    nocreate
    sharedscripts
    prerotate
    test ! -x /usr/sbin/sarg-maint || /usr/sbin/sarg-maint
    endscript
    postrotate
    test ! -e /var/run/squid.pid || /usr/sbin/squid -k rotate
    endscript
    }