My 64GB MicroSD (running Raspbian Lite) is full, but it's all because of Logs?

The Raspberry Pi is a series of credit card-sized single-board computers developed in the United Kingdom by the Raspberry Pi Foundation to promote the teaching of basic computer science in schools and developing countries.

Post Reply
User avatar
/RaspberryPi
Corporate
Posts: 2449
Joined: Wed Jun 05, 2019 1:29 am

My 64GB MicroSD (running Raspbian Lite) is full, but it's all because of Logs?

Post by /RaspberryPi »

TL;DR: How to delete logs that take up huge size. How to possibly auto delete them?
Hello there! My Raspberry Pi was throwing some errors when I tried updating a specific program on it (NextCloud/NextCloudPi), it said that there was no storage left.
I checked using the help from this article:
df -h
This displays the available disk space on every partition in a human readable format.
Now, this threw me the following:
Filesystem Size Used Avail Use% Mounted on /dev/root 59G 59G 0 100% /
Showing that my /dev/root filesystem was ENTIRELY full. I was wondering why, so utilized this Raspberry Pi forum post to help me find a command to check:
sudo du -sh * I executed this in the root directory
Here is told me that the “varâ€￾ directory used 55GB of storage. Using 55GB of 59GB available is quite suspicious.
So, I executed the command again inside of the “varâ€￾ directory. Here it told me that 55GB were used up in the “logâ€￾ directory. So, I checked the log directory:
0 alternatives.log 4.0K alternatives.log.1 4.0K alternatives.log.2.gz 4.0K alternatives.log.3.gz 4.0K alternatives.log.4.gz 4.0K alternatives.log.5.gz 4.0K alternatives.log.6.gz 4.0K alternatives.log.7.gz 4.0K alternatives.log.8.gz 1.8M apache2 144K apt 648K auth.log 800K auth.log.1 52K auth.log.2.gz 52K auth.log.3.gz 52K auth.log.4.gz 0 btmp 0 btmp.1 34G daemon.log 91M daemon.log.1 7.1M daemon.log.2.gz 3.9M daemon.log.3.gz 7.8M daemon.log.4.gz 0 debug 4.0K debug.1 4.0K debug.2.gz 4.0K debug.3.gz 4.0K debug.4.gz 8.0K dpkg.log 20K dpkg.log.1 24K dpkg.log.10.gz 4.0K dpkg.log.2.gz 4.0K dpkg.log.3.gz 4.0K dpkg.log.4.gz 16K dpkg.log.5.gz 4.0K dpkg.log.6.gz 4.0K dpkg.log.7.gz 4.0K dpkg.log.8.gz 4.0K dpkg.log.9.gz 4.0K fail2ban.log 12K fail2ban.log.1 4.0K fail2ban.log.2.gz 4.0K fail2ban.log.3.gz 4.0K fail2ban.log.4.gz 4.0K fontconfig.log 720K kern.log 1.8M kern.log.1 160K kern.log.2.gz 240K kern.log.3.gz 136K kern.log.4.gz 8.0K lastlog 60K letsencrypt 0 mail.err 4.0K mail.err.1 4.0K mail.info 4.0K mail.info.1 4.0K mail.info.2.gz 4.0K mail.info.3.gz 4.0K mail.info.4.gz 4.0K mail.log 4.0K mail.log.1 4.0K mail.log.2.gz 4.0K mail.log.3.gz 4.0K mail.log.4.gz 0 mail.warn 4.0K mail.warn.1 4.0K mail.warn.2.gz 4.0K mail.warn.3.gz 4.0K mail.warn.4.gz 724K messages 1.8M messages.1 160K messages.2.gz 240K messages.3.gz 140K messages.4.gz 32K mysql 220K ncp.log 52K ncp.log.1.gz 64K ncp.log.2.gz 48K ncp.log.3.gz 56K ncp.log.4.gz 28K nginx 4.0K php7.3-fpm.log 4.0K php7.3-fpm.log.1 4.0K php7.3-fpm.log.10.gz 4.0K php7.3-fpm.log.11.gz 4.0K php7.3-fpm.log.12.gz 4.0K php7.3-fpm.log.2.gz 4.0K php7.3-fpm.log.3.gz 4.0K php7.3-fpm.log.4.gz 4.0K php7.3-fpm.log.5.gz 4.0K php7.3-fpm.log.6.gz 4.0K php7.3-fpm.log.7.gz 4.0K php7.3-fpm.log.8.gz 4.0K php7.3-fpm.log.9.gz 320K postgresql 4.0K private 4.0K prometheus 1.4M redis 4.0K samba 12G syslog 5.6G syslog.1 40M syslog.2.gz 25M syslog.3.gz 31M syslog.4.gz 14M syslog.5.gz 1.4M syslog.6.gz 1.3M syslog.7.gz 4.0K sysstat 0 ufw.log 128K unattended-upgrades 0 user.log 4.0K user.log.1 4.0K user.log.2.gz 4.0K user.log.3.gz 4.0K user.log.4.gz 0 vsftpd.log 4.0K vsftpd.log.1 56K vsftpd.log.2 4.0K wicd 232K wtmp
Most notably: 34G daemon.log 12G syslog 5.6G syslog.1
Why do these logs take up so much storage? I mean, I guess the server has been running for a year now without interruption.
Can I delete these logs? Is that okay? Should I end all processes whilst doing so? Is this log size normal? I wasn't aware that it was logging at all. Can I set up a system where logs are automatically deleted after a week/month/year?
Any response would help!

submitted by /u/NotErikUden
[link] [comments]

More...
Post Reply

Return to “Raspberry Pi Forum”