Large maillog
Is there a way to clear the contents of /var/log/maillog
? Mine has grown excessively large, exceeding 20GB.
I'm unsure where to check the configuration settings to manage its size or which terminal command to use to free up this space.
Any assistance would be appreciated. Cheers
-
I found this article, not sure if this should be performed on the maillog file....
0 -
Hey there! If you are certain that you don't need the data in the maillog file you can go ahead and execute the /dev/null command on it mentioned in the article. That just empties the file without changing anything else.
You may want to adjust the log rotation on your server so this work happens automatically - you can check out documentation at https://docs.cpanel.net/whm/service-configuration/cpanel-log-rotation-configuration/ for more details on how to adjust the files that are rotated.
0 -
Thanks cPRex - I always find it a little daunting deleting files but "cat /dev/null > maillog" worked a treat.
Log rotation was enabled but I had the size set to 3GB, though for maillog to be >20GB I suspect this file may not be included?
Anyhow sorted for now, so thank you again.
0 -
Yes, the exim_mainlog file does get rotated, but we don't include /var/log/maillog by default as that usually doesn't grow to this size.
0 -
I was wondering how the maillog gets rotated, and I found this:
In /etc/logrotate.d/syslog there is:
/var/log/cron
/var/log/maillog
/var/log/messages
/var/log/secure
/var/log/spooler
{
missingok
sharedscripts
postrotate
/usr/bin/systemctl -s HUP kill rsyslog.service >/dev/null 2>&1 || true
endscript
}and in /etc/logrotate.conf this:
# see "man logrotate" for details
# rotate log files weekly
weekly# keep 4 weeks worth of backlogs
rotate 4# create new (empty) log files after rotating old ones
create# use date as a suffix of the rotated file
dateext# uncomment this if you want your log files compressed
compress# RPM packages drop log rotation information into this directory
include /etc/logrotate.d# system-specific logs may be also be configured here.
and indeed maillog is rotated weekly and 4 compressed logs is kept.
This is in AlmaLinux 8 and CloudLinux 8.
0 -
I'm seeing the same problem in all of my servers. I can make a copy of the logs and truncate them, but I do believe there is something more to it. The maillog file is > 10G in all of the servers, in only 2.5 days.
0 -
Mine is back to 1GB after 7 days.
I checked and found /etc/logrotate.d/syslog doesn't exist on my CloudLinux v9.5.0 server whereas /etc/logrotate.conf does.
I think in my case nothing is being rotated since the file doesn't exist0 -
It looks like other users have reported that missing with CloudLinux 9 as well, such as this link here:
https://forum.directadmin.com/threads/directadmin-on-cloudlinux-9.70352/post-376701
so it's not just you running into that. I've reached out to the CloudLinux team and I'll let you know what they have to say!
0 -
It seems this is a known issue and that you can install the rsyslog-logrotate package in order to get that working.
0
Please sign in to leave a comment.
Comments
9 comments