<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: cleaning up /var in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/cleaning-up-var/m-p/4514340#M38571</link>
    <description>Hello,&lt;BR /&gt;&lt;BR /&gt;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.&lt;BR /&gt;&lt;BR /&gt;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&lt;BR /&gt;&lt;BR /&gt;Run the find command against "/var" mount point to discover other log files that could be candidates for trimming.&lt;BR /&gt;&lt;BR /&gt;Run man logrotate command for more info on logrotate function.&lt;BR /&gt;&lt;BR /&gt;Cheers.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Thu, 15 Oct 2009 12:44:21 GMT</pubDate>
    <dc:creator>loco_vikide</dc:creator>
    <dc:date>2009-10-15T12:44:21Z</dc:date>
    <item>
      <title>cleaning up /var</title>
      <link>https://community.hpe.com/t5/operating-system-linux/cleaning-up-var/m-p/4514335#M38566</link>
      <description>I have a question about cleaning up of /var on linux. Like we trim the syslog.log and other log files in hpux and then just save the old ones in compressed form. What approach we should adopt in RHEL because in RHEL, they have /var/log/message, message1, 2, and 3. What other things can we check if we are cleaning up /var on RHEL.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 14 Oct 2009 17:27:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/cleaning-up-var/m-p/4514335#M38566</guid>
      <dc:creator>Waqar Razi</dc:creator>
      <dc:date>2009-10-14T17:27:55Z</dc:date>
    </item>
    <item>
      <title>Re: cleaning up /var</title>
      <link>https://community.hpe.com/t5/operating-system-linux/cleaning-up-var/m-p/4514336#M38567</link>
      <description>Just to add some thing to my post,&lt;BR /&gt;&lt;BR /&gt;-rw-r----- 1 root root 370199688 Oct 14 11:28 messages&lt;BR /&gt;-rw-r----- 1 root root 785214202 Oct 11 04:07 messages.1&lt;BR /&gt;-rw-r----- 1 root root 790338206 Oct  4 04:07 messages.2&lt;BR /&gt;-rw-r----- 1 root root 790509595 Sep 27 04:07 messages.3&lt;BR /&gt;-rw-r----- 1 root root 790481660 Sep 20 04:07 messages.4&lt;BR /&gt;</description>
      <pubDate>Wed, 14 Oct 2009 17:29:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/cleaning-up-var/m-p/4514336#M38567</guid>
      <dc:creator>Waqar Razi</dc:creator>
      <dc:date>2009-10-14T17:29:34Z</dc:date>
    </item>
    <item>
      <title>Re: cleaning up /var</title>
      <link>https://community.hpe.com/t5/operating-system-linux/cleaning-up-var/m-p/4514337#M38568</link>
      <description>In RHEL the logrotate program is used to rotate/keep versions of your file. In the logrotate.conf you can specify how much versions you want to keep, and other files to rotate.&lt;BR /&gt;&lt;BR /&gt;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.&lt;BR /&gt;&lt;BR /&gt;Just run du -sh * in the /var directory to identify where you get the most big directory.</description>
      <pubDate>Wed, 14 Oct 2009 18:41:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/cleaning-up-var/m-p/4514337#M38568</guid>
      <dc:creator>Ivan Ferreira</dc:creator>
      <dc:date>2009-10-14T18:41:28Z</dc:date>
    </item>
    <item>
      <title>Re: cleaning up /var</title>
      <link>https://community.hpe.com/t5/operating-system-linux/cleaning-up-var/m-p/4514338#M38569</link>
      <description>Do a du -sk /var and go from there.&lt;BR /&gt;Probably some stuff under /var/spool/up2date.</description>
      <pubDate>Wed, 14 Oct 2009 23:46:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/cleaning-up-var/m-p/4514338#M38569</guid>
      <dc:creator>D. Jackson_1</dc:creator>
      <dc:date>2009-10-14T23:46:24Z</dc:date>
    </item>
    <item>
      <title>Re: cleaning up /var</title>
      <link>https://community.hpe.com/t5/operating-system-linux/cleaning-up-var/m-p/4514339#M38570</link>
      <description>There should also be some available space occupied by the rpm database. The database can be trimmed if you know how, e.g. redundant, i.e. old, versions of packages could be removed from the database. Unfortunately, I'm not too familiar with how. But perhaps the forum can aid.  &lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 15 Oct 2009 09:42:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/cleaning-up-var/m-p/4514339#M38570</guid>
      <dc:creator>Runar Jørgensen</dc:creator>
      <dc:date>2009-10-15T09:42:57Z</dc:date>
    </item>
    <item>
      <title>Re: cleaning up /var</title>
      <link>https://community.hpe.com/t5/operating-system-linux/cleaning-up-var/m-p/4514340#M38571</link>
      <description>Hello,&lt;BR /&gt;&lt;BR /&gt;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.&lt;BR /&gt;&lt;BR /&gt;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&lt;BR /&gt;&lt;BR /&gt;Run the find command against "/var" mount point to discover other log files that could be candidates for trimming.&lt;BR /&gt;&lt;BR /&gt;Run man logrotate command for more info on logrotate function.&lt;BR /&gt;&lt;BR /&gt;Cheers.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 15 Oct 2009 12:44:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/cleaning-up-var/m-p/4514340#M38571</guid>
      <dc:creator>loco_vikide</dc:creator>
      <dc:date>2009-10-15T12:44:21Z</dc:date>
    </item>
    <item>
      <title>Re: cleaning up /var</title>
      <link>https://community.hpe.com/t5/operating-system-linux/cleaning-up-var/m-p/4514341#M38572</link>
      <description>&lt;!--!*#--&gt;Like Ivan mentioned, &lt;BR /&gt;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)&lt;BR /&gt;&lt;BR /&gt;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.&lt;BR /&gt;&lt;BR /&gt;Here, for instance is mine, which is almost the original as installed (except for the tabooext entries)&lt;BR /&gt;&lt;BR /&gt;# grep ^[^#] /etc/logrotate.conf &lt;BR /&gt;weekly&lt;BR /&gt;rotate 4&lt;BR /&gt;create&lt;BR /&gt;tabooext + .dormant .deferred .stalled&lt;BR /&gt;include /etc/logrotate.d&lt;BR /&gt;/var/log/wtmp {&lt;BR /&gt;    monthly&lt;BR /&gt;    create 0664 root utmp&lt;BR /&gt;    rotate 1&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;As you can see, it globally defines to keep 4 rotated generations of log files (unless overridden in a later curly bracketed section.&lt;BR /&gt;Also note that this global config includes all files that don't end in tabooext suffixes from the directory /etc/logrotate.d,&lt;BR /&gt;and this is the place where you will find more specific definitions for most of the services that keep log files.&lt;BR /&gt;For instance, the messages file's rotation is defined in /etc/logrotate.d/syslog&lt;BR /&gt;&lt;BR /&gt;# cat /etc/logrotate.d/syslog &lt;BR /&gt;/var/log/messages /var/log/secure /var/log/maillog /var/log/spooler /var/log/boot.log /var/log/cron {&lt;BR /&gt;    sharedscripts&lt;BR /&gt;    postrotate&lt;BR /&gt;        /bin/kill -HUP `cat /var/run/syslogd.pid 2&amp;gt; /dev/null` 2&amp;gt; /dev/null || true&lt;BR /&gt;    endscript&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;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.&lt;BR /&gt;&lt;BR /&gt;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)&lt;BR /&gt;As you can see from the timestamps of your rotate logs the global default of "weekly" rotations applies.&lt;BR /&gt;If you require more frequent rotations put the "daily" keyword in the syslog's config block.&lt;BR /&gt;&lt;BR /&gt;There are lots of further keywords that influence the rotation scheme.&lt;BR /&gt;Please consult "man logrotate".&lt;BR /&gt;&lt;BR /&gt;The execution of logrotate is controlled by cron.&lt;BR /&gt;In the system's main crontab you will find these entries&lt;BR /&gt;&lt;BR /&gt;# grep run-parts /etc/crontab &lt;BR /&gt;# run-parts&lt;BR /&gt;01 * * * * root run-parts /etc/cron.hourly&lt;BR /&gt;02 4 * * * root run-parts /etc/cron.daily&lt;BR /&gt;22 4 * * 0 root run-parts /etc/cron.weekly&lt;BR /&gt;42 4 1 * * root run-parts /etc/cron.monthly&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;of which /etc/cron.daily/logrotate eventually executes the logrotate command on a daily basis&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;# cat /etc/cron.daily/logrotate&lt;BR /&gt;#!/bin/sh&lt;BR /&gt;&lt;BR /&gt;/usr/sbin/logrotate /etc/logrotate.conf&lt;BR /&gt;EXITVALUE=$?&lt;BR /&gt;if [ $EXITVALUE != 0 ]; then&lt;BR /&gt;    /usr/bin/logger -t logrotate "ALERT exited abnormally with [$EXITVALUE]"&lt;BR /&gt;fi&lt;BR /&gt;exit 0&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;After your changes to any of the logrotate config files you ought to run a pre-flight check by issuing e.g.&lt;BR /&gt;&lt;BR /&gt;# /usr/sbin/logrotate -d /etc/logrotate.conf&lt;BR /&gt;&lt;BR /&gt;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.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 15 Oct 2009 13:14:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/cleaning-up-var/m-p/4514341#M38572</guid>
      <dc:creator>Ralph Grothe</dc:creator>
      <dc:date>2009-10-15T13:14:25Z</dc:date>
    </item>
    <item>
      <title>Re: cleaning up /var</title>
      <link>https://community.hpe.com/t5/operating-system-linux/cleaning-up-var/m-p/4514342#M38573</link>
      <description>Ralph - Would you please show an example how you would add the "compress" and "Daily" within the block in syslog you've mentioned??&lt;BR /&gt;&lt;BR /&gt;I am very interested in learning more on how we can rotate these log files and compressed them as needed.&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;&lt;BR /&gt;David&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;cat /etc/logrotate.d/syslog&lt;BR /&gt;/var/log/messages /var/log/secure /var/log/maillog /var/log/spooler /var/log/boot.log /var/log/cron {&lt;BR /&gt;    sharedscripts&lt;BR /&gt;    postrotate&lt;BR /&gt;        /bin/kill -HUP `cat /var/run/syslogd.pid 2&amp;gt; /dev/null` 2&amp;gt; /dev/null || true&lt;BR /&gt;    endscript&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 06 Nov 2009 13:43:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/cleaning-up-var/m-p/4514342#M38573</guid>
      <dc:creator>d_allen111</dc:creator>
      <dc:date>2009-11-06T13:43:45Z</dc:date>
    </item>
    <item>
      <title>Re: cleaning up /var</title>
      <link>https://community.hpe.com/t5/operating-system-linux/cleaning-up-var/m-p/4514343#M38574</link>
      <description>Hi Waqar Razi,&lt;BR /&gt;&lt;BR /&gt;Can you Check "MS Power point" attachment file&lt;BR /&gt;&lt;BR /&gt;which has been created by "Dusan Baljevic&lt;BR /&gt;"&lt;BR /&gt;&lt;BR /&gt;which give better picture how to maintain System Logs &lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Johnson</description>
      <pubDate>Sat, 07 Nov 2009 17:44:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/cleaning-up-var/m-p/4514343#M38574</guid>
      <dc:creator>Johnson Punniyalingam</dc:creator>
      <dc:date>2009-11-07T17:44:28Z</dc:date>
    </item>
  </channel>
</rss>

