Mirat el man del logrotate, sobretot el fitxer de configuració, ja que pots
limitar el tamany dels fitxers de log, ja que un fitxer de 2 GB es un
disbarat totalment inutil per il·legible.

en una plana (http: // linux . die . net / man / 8 / logrotate) hi trobem
aquest exemple:

# sample logrotate configuration file
compress

/var/log/messages {
    rotate 5
    weekly
    postrotate
        /usr/bin/killall -HUP syslogd
    endscript
}

"/var/log/httpd/access.log" /var/log/httpd/error.log {
    rotate 5
    mail w...@my.org
    size 100k
    sharedscripts
    postrotate
        /usr/bin/killall -HUP httpd
    endscript
}

/var/log/news/* {
    monthly
    rotate 2
    olddir /var/log/news/old
    missingok
    postrotate
        kill -HUP 'cat /var/run/inn.pid'
    endscript
    nocompress
}

The first few lines set global options; in the example, logs are compressed
after they are rotated. Note that comments may appear anywhere in the
config file as long as the first non-whitespace character on the line is a
#.

The next section of the config files defined how to handle the log file
*/var/log/messages*. The log will go through five weekly rotations before
being removed. After the log file has been rotated (but before the old
version of the log has been compressed), the command */sbin/killall -HUP
syslogd* will be executed.

The next section defines the parameters for both */var/log/httpd/access.log*and
*/var/log/httpd/error.log*. They are rotated whenever it grows over 100k in
size, and the old logs files are mailed (uncompressed) to w...@my.org after
going through 5 rotations, rather than being removed. The
*sharedscripts*means that the
*postrotate* script will only be run once (after the old logs have been
compressed), not once for each log which is rotated. Note that the double
quotes around the first filename at the beginning of this section allows
logrotate to rotate logs with spaces in the name. Normal shell quoting
rules apply, with ', ", and \ characters supported.

The last section defines the parameters for all of the files in
*/var/log/news*. Each file is rotated on a monthly basis. This is
considered a single rotation directive and if errors occur for more than
one file, the log files are not compressed.

Please use wildcards with caution. If you specify *, *logrotate* will
rotate all files, including previously rotated ones. A way around this is
to use the *olddir* directive or a more exact wildcard (such as *.log).


*Xavier De Yzaguirre*
xdeyzaguirre(at)gmail(dot)com



El dia 20 de novembre de 2013 20.16, Jordi Boixader (Idroj) <
id...@bergueda.org> ha escrit:

>  Gràcies pels consells.
>
> els .log que tenia grans, els he esborrat/buidat com diu la Blackhold:
> echo "" > fitxer.log
>
> només m'ha quedat un fitxer anomenat "syslog" sense .log que no m'he
> atrevit a esborrar/buidar.
>
> el logrotate he vist que ja el tinc instal·lat i ja deu funcionar, perquè
> tinc grups de 4 del mateix arxiu "rotat" 1.gz, 2.gz, 3.gz, 4.gz
>
> No se si aquest "syslog" que m'ha quedat, amb el temps el farà
> desaparèixer el logrotate. (espero que si, de moment l'he deixar a veure si
> en un temps marxa)
>
> Salut.
> Jordi Boixader (Idroj)
> http://jordi.boixader.com
>
>
> Al 20/11/13 00:58, En/na Blackhold ha escrit:
>
> per buidar aquests fitxers si hi ha els xxxx.1.gz, etc. pots borrar-los
> directament o configurar el logrotate perquè no en guardi tants.
>
>  per buidar els que són .log tal cual
>
>  echo "" > fitxer.log
>
>  millor fer-ho així perquè a vegades hi ha algun fitxer de log que el
> crea el programa directament i després no té permisos per escriure al
> directori i després el programa es queixa i no te n'enteres perquè no pot
> escriure als logs...
>
>
> - Blackhold
> http://marsupi.org
> ~> cal lluitar contra el fort per deixar de ser febles, i contra nosaltres
> mateixos quan siguem forts (Esquirols)
>
>
> El dia 19 de novembre de 2013 23.58, Jordi Boixader (Idroj) <
> jo...@boixader.com> ha escrit:
>
>> Pensava que s'havia solucionat el fallo de l'USB, al tornar a reiniciar,
>> tornava a sortir l'error.
>>
>> Solució, he entrat a la BIOS i he anul·lat els ports USB.
>>
>> Ara ja no surt l'error, això si, no tinc USBs. (però tampoc em calen, ja
>> que es un servidor de guifi.net) i hi tinc un teclat per PS/2
>>
>>
>>
>> Ara després d'haver estat fent l'error durant força temps, m'he mirat la
>> carpeta: /var/log
>>
>> i dins hi ha 2 arxius molt grans:
>>
>> kernel.log - 2.4 Gb
>> syslog - 2,5 Gb
>>
>> els altres son petits, potser el més gran supera les 200 Mb.
>>
>> Es poden esborrar o buidar-los perquè no ocupin tant? Es recomanable
>> fer-ho? com s'ha de fer?
>>
>>
>> Salut.
>> Jordi Boixader.
>>
>>
>> --
>> To UNSUBSCRIBE, email to debian-user-catalan-requ...@lists.debian.org
>> with a subject of "unsubscribe". Trouble? Contact
>> listmas...@lists.debian.org
>> Archive: http://lists.debian.org/528bed0a.9020...@boixader.com
>>
>>
>
>

Respondre per correu electrònic a