Borrar log
Sebastian Abate
sebastianabate en gmail.com
Mar Jun 17 15:26:34 BST 2008
2008/6/17 Edwin Hernán Hurtado Cruz <thaednevol en gmail.com>:
> Buen día
>
> Amigos, tengo un problema: me estoy quedando sin espacio en disco en la
> partición raíz, ya he borrado con el synaptic la configuración residual, con
> apt-get, clean y autoclean, utilicé un programa llamado kleansweep, borrando
> los enlaces simbólicos rotos, los archivos de copia de seguridad y las
> miniaturas obsoletas. Sin embargo, lo que se recupera no es mucho, y además
> me doy cuenta que en /var/log, los archivos daemon.log y syslog pesan 1.4 GB
> cada uno. Me gustaría saber si los puedo borrar sin afectar el sistema.
> Gracias
>
> --
> El hombre, así como el software, debe ser libre. GNU es libertad.
> Linux user #461462
> --
> ubuntu-es mailing list
> ubuntu-es en lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/ubuntu-es
>
Como poder, podés borrarlos, ya que en cuanto el sistema tenga que
escribir algo en alguno de los archivos los va a crear nuevamente;
pero no lo veo como una solución.
Me parece que el problema que tenés es que no se está ejecutando el
sysklogd de tu cron (que lo que hace justamente es comprimir los logs
del sistema e ir rotándolos de acuerdo a una configuración
establecida). Fijate si existe en el directorio /etc/cron.daily el
archivo sysklogd, y si el contenido es algo parecido a esto:
#! /bin/sh
# sysklogd Cron script to rotate system log files daily.
#
# If you want to rotate other logfiles daily, edit
# this script. An easy way is to add files manually,
# to add -a (for all log files) to syslogd-listfiles and
# add some grep stuff, or use the -s pattern argument to
# specify files that must not be listed.
#
# This is a configration file. You are invited to edit
# it and maintain it on your own. You'll have to do
# that if you don't like the default policy
# wrt. rotating logfiles (i.e. with large logfiles
# weekly and daily rotation may interfere). If you edit
# this file and don't let dpkg upgrade it, you have full
# control over it. Please read the manpage to
# syslogd-listfiles.
#
# Written by Martin Schulze <joey en debian.org>.
# $Id: cron.daily,v 1.14 2007-05-28 16:33:34 joey Exp $
test -x /usr/sbin/syslogd-listfiles || exit 0
test -x /sbin/syslogd || exit 0
test -f /usr/share/sysklogd/dummy || exit 0
USER=$(ps -C syslogd -o user= | head -n 1)
[ -z "${USER}" ] && USER="root" || true
set -e
cd /var/log
logs=$(syslogd-listfiles)
test -n "$logs" || exit 0
for LOG in $logs
do
if [ -s $LOG ]; then
savelog -g adm -m 640 -u ${USER} -c 7 $LOG >/dev/null
fi
done
# Restart syslogd
#
/etc/init.d/sysklogd reload-or-restart > /dev/null
Y también verificá que exista el archivo /etc/syslog.conf y que el
contenido sea algo como esto:
# /etc/syslog.conf Configuration file for syslogd.
#
# For more information see syslog.conf(5)
# manpage.
#
# First some standard logfiles. Log by facility.
#
auth,authpriv.* /var/log/auth.log
*.*;auth,authpriv.none -/var/log/syslog <<<<< Lo que te interesa
#cron.* /var/log/cron.log
daemon.* -/var/log/daemon.log <<<<< Este también
kern.* -/var/log/kern.log
lpr.* -/var/log/lpr.log
mail.* -/var/log/mail.log
user.* -/var/log/user.log
#
# Logging for the mail system. Split it up so that
# it is easy to write scripts to parse these files.
#
mail.info -/var/log/mail.info
mail.warn -/var/log/mail.warn
mail.err /var/log/mail.err
# Logging for INN news system
#
news.crit /var/log/news/news.crit
news.err /var/log/news/news.err
news.notice -/var/log/news/news.notice
#
# Some `catch-all' logfiles.
#
*.=debug;\
auth,authpriv.none;\
news.none;mail.none -/var/log/debug
*.=info;*.=notice;*.=warn;\
auth,authpriv.none;\
cron,daemon.none;\
mail,news.none -/var/log/messages
#
# Emergencies are sent to everybody logged in.
#
*.emerg *
#
# I like to have messages displayed on the console, but only on a virtual
# console I usually leave idle.
#
#daemon,mail.*;\
# news.=crit;news.=err;news.=notice;\
# *.=debug;*.=info;\
# *.=notice;*.=warn /dev/tty8
# The named pipe /dev/xconsole is for the `xconsole' utility. To use it,
# you must invoke `xconsole' with the `-file' option:
#
# $ xconsole -file /dev/xconsole [...]
#
# NOTE: adjust the list below, or you'll go crazy if you have a reasonably
# busy site..
#
daemon.*;mail.*;\
news.err;\
*.=debug;*.=info;\
*.=notice;*.=warn |/dev/xconsole
Si existen los dos archivos y siguen sin rotar los logs de sistema,
entonces el problema debe estar en la ejecución del cron; fijate en el
archivo syslog (menos mal que no lo borraste, no?) y buscá los
mensajes que contengan "cron" con
cat /var/log/syslog |grep cron
A ver si te aparece algún error que te diga cuál puede ser el problema.
--
Sebastián Abate
Quattro-D
15-3589-7730
abates en quattrod.com.ar
Más información sobre la lista de distribución ubuntu-es