- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Re: cleaning up /var
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-14-2009 10:27 AM
тАО10-14-2009 10:27 AM
cleaning up /var
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-14-2009 10:29 AM
тАО10-14-2009 10:29 AM
Re: cleaning up /var
-rw-r----- 1 root root 370199688 Oct 14 11:28 messages
-rw-r----- 1 root root 785214202 Oct 11 04:07 messages.1
-rw-r----- 1 root root 790338206 Oct 4 04:07 messages.2
-rw-r----- 1 root root 790509595 Sep 27 04:07 messages.3
-rw-r----- 1 root root 790481660 Sep 20 04:07 messages.4
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-14-2009 11:41 AM
тАО10-14-2009 11:41 AM
Re: cleaning up /var
You should also check /var/spool/ directory, there are some "spool" files like mail and printing files that should be handled. For example, if no one ever reads that root mail, you will have a big file there.
Just run du -sh * in the /var directory to identify where you get the most big directory.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-14-2009 04:46 PM
тАО10-14-2009 04:46 PM
Re: cleaning up /var
Probably some stuff under /var/spool/up2date.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-15-2009 02:42 AM
тАО10-15-2009 02:42 AM
Re: cleaning up /var
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-15-2009 05:44 AM
тАО10-15-2009 05:44 AM
Re: cleaning up /var
First, modify the config file /etc/logrotate.conf. Turn on "compress" feature, change "rotate" value, "minsize" value and "weekly" log rotate value to fit your needs.
Take a look at directory /var/log and decide which logs you want to trim on frequent basis. Most to all of them could be trimmed. Then add the log file entries in the config file /etc/logrotate.d/syslog
Run the find command against "/var" mount point to discover other log files that could be candidates for trimming.
Run man logrotate command for more info on logrotate function.
Cheers.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-15-2009 06:14 AM
тАО10-15-2009 06:14 AM
Re: cleaning up /var
almost any Linux distro today uses the logrotate program for rotation of most of the log files on their system (of which most will be found in subdirs named according to their services beneath /var/log)
Especially, on RHEL systems you have the main configuration in /etc/logrotate.conf which merely is a stub for global settings and the wtmp file.
Here, for instance is mine, which is almost the original as installed (except for the tabooext entries)
# grep ^[^#] /etc/logrotate.conf
weekly
rotate 4
create
tabooext + .dormant .deferred .stalled
include /etc/logrotate.d
/var/log/wtmp {
monthly
create 0664 root utmp
rotate 1
}
As you can see, it globally defines to keep 4 rotated generations of log files (unless overridden in a later curly bracketed section.
Also note that this global config includes all files that don't end in tabooext suffixes from the directory /etc/logrotate.d,
and this is the place where you will find more specific definitions for most of the services that keep log files.
For instance, the messages file's rotation is defined in /etc/logrotate.d/syslog
# cat /etc/logrotate.d/syslog
/var/log/messages /var/log/secure /var/log/maillog /var/log/spooler /var/log/boot.log /var/log/cron {
sharedscripts
postrotate
/bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true
endscript
}
As you can see, all the files listed to the left of the opening curly bracket will be affected by what follows in the block.
If you wish to have your rotate log files to be compressed just place the "compress" keyword in the block, and if you want to keep fewer than 4 generations insert an e.g. "rotate 2" there (rotate 0 would keep no old copies)
As you can see from the timestamps of your rotate logs the global default of "weekly" rotations applies.
If you require more frequent rotations put the "daily" keyword in the syslog's config block.
There are lots of further keywords that influence the rotation scheme.
Please consult "man logrotate".
The execution of logrotate is controlled by cron.
In the system's main crontab you will find these entries
# grep run-parts /etc/crontab
# run-parts
01 * * * * root run-parts /etc/cron.hourly
02 4 * * * root run-parts /etc/cron.daily
22 4 * * 0 root run-parts /etc/cron.weekly
42 4 1 * * root run-parts /etc/cron.monthly
of which /etc/cron.daily/logrotate eventually executes the logrotate command on a daily basis
# cat /etc/cron.daily/logrotate
#!/bin/sh
/usr/sbin/logrotate /etc/logrotate.conf
EXITVALUE=$?
if [ $EXITVALUE != 0 ]; then
/usr/bin/logger -t logrotate "ALERT exited abnormally with [$EXITVALUE]"
fi
exit 0
After your changes to any of the logrotate config files you ought to run a pre-flight check by issuing e.g.
# /usr/sbin/logrotate -d /etc/logrotate.conf
The debug option will only examine which files would be due to a be rotated and print what it would do but actually wouldn't touch any of the files.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-06-2009 05:43 AM
тАО11-06-2009 05:43 AM
Re: cleaning up /var
I am very interested in learning more on how we can rotate these log files and compressed them as needed.
Thanks,
David
cat /etc/logrotate.d/syslog
/var/log/messages /var/log/secure /var/log/maillog /var/log/spooler /var/log/boot.log /var/log/cron {
sharedscripts
postrotate
/bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true
endscript
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-07-2009 09:44 AM
тАО11-07-2009 09:44 AM
Re: cleaning up /var
Can you Check "MS Power point" attachment file
which has been created by "Dusan Baljevic
"
which give better picture how to maintain System Logs
Thanks,
Johnson