<?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: Auto Trimming of log files in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/auto-trimming-of-log-files/m-p/3462222#M704002</link>
    <description>hi, &lt;BR /&gt; &lt;BR /&gt;you can write your own script to cut off lines when it's bigger than n lines or n MB.&lt;BR /&gt;But if you do not want to reinvent the wheel then have a loot at:&lt;BR /&gt;&lt;A href="http://hpux.its.tudelft.nl/hppd/hpux/Sysadmin/logrotate-2.5/" target="_blank"&gt;http://hpux.its.tudelft.nl/hppd/hpux/Sysadmin/logrotate-2.5/&lt;/A&gt;&lt;BR /&gt; &lt;BR /&gt;regards,&lt;BR /&gt;Thierry.</description>
    <pubDate>Thu, 13 Jan 2005 03:39:19 GMT</pubDate>
    <dc:creator>Thierry Poels_1</dc:creator>
    <dc:date>2005-01-13T03:39:19Z</dc:date>
    <item>
      <title>Auto Trimming of log files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/auto-trimming-of-log-files/m-p/3462219#M703999</link>
      <description>Hi,&lt;BR /&gt; &lt;BR /&gt;  I have written a script to capture activities on my system. However I am afraid that the log might grow too large in future.. Is there any ingenious way to write another script so as to check and delete the lines in the log that is say 30days old?&lt;BR /&gt;&lt;BR /&gt;Thank u..&lt;BR /&gt;</description>
      <pubDate>Thu, 13 Jan 2005 03:08:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/auto-trimming-of-log-files/m-p/3462219#M703999</guid>
      <dc:creator>Henry Chua</dc:creator>
      <dc:date>2005-01-13T03:08:52Z</dc:date>
    </item>
    <item>
      <title>Re: Auto Trimming of log files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/auto-trimming-of-log-files/m-p/3462220#M704000</link>
      <description>What about a simple rotate log every 30 day and keep 1 or 2 archived log file ?&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;Fred&lt;BR /&gt;</description>
      <pubDate>Thu, 13 Jan 2005 03:23:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/auto-trimming-of-log-files/m-p/3462220#M704000</guid>
      <dc:creator>Fred Ruffet</dc:creator>
      <dc:date>2005-01-13T03:23:11Z</dc:date>
    </item>
    <item>
      <title>Re: Auto Trimming of log files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/auto-trimming-of-log-files/m-p/3462221#M704001</link>
      <description>You can use SAM also to trim the log files.&lt;BR /&gt;&lt;BR /&gt;sks</description>
      <pubDate>Thu, 13 Jan 2005 03:33:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/auto-trimming-of-log-files/m-p/3462221#M704001</guid>
      <dc:creator>Sanjay Kumar Suri</dc:creator>
      <dc:date>2005-01-13T03:33:30Z</dc:date>
    </item>
    <item>
      <title>Re: Auto Trimming of log files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/auto-trimming-of-log-files/m-p/3462222#M704002</link>
      <description>hi, &lt;BR /&gt; &lt;BR /&gt;you can write your own script to cut off lines when it's bigger than n lines or n MB.&lt;BR /&gt;But if you do not want to reinvent the wheel then have a loot at:&lt;BR /&gt;&lt;A href="http://hpux.its.tudelft.nl/hppd/hpux/Sysadmin/logrotate-2.5/" target="_blank"&gt;http://hpux.its.tudelft.nl/hppd/hpux/Sysadmin/logrotate-2.5/&lt;/A&gt;&lt;BR /&gt; &lt;BR /&gt;regards,&lt;BR /&gt;Thierry.</description>
      <pubDate>Thu, 13 Jan 2005 03:39:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/auto-trimming-of-log-files/m-p/3462222#M704002</guid>
      <dc:creator>Thierry Poels_1</dc:creator>
      <dc:date>2005-01-13T03:39:19Z</dc:date>
    </item>
    <item>
      <title>Re: Auto Trimming of log files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/auto-trimming-of-log-files/m-p/3462223#M704003</link>
      <description>Hi Henrry.&lt;BR /&gt;Intead of using one file for all. My crontab script write out one file for one day. like this:&lt;BR /&gt;[TIAN:/] cat script/ia_start.sh&lt;BR /&gt;################# Applciation Start Script for cron file #################&lt;BR /&gt;&lt;BR /&gt;#### Make the log_file ####&lt;BR /&gt;&lt;BR /&gt;GetDate=`date +"%Y%m%d"`&lt;BR /&gt;LOG_NM=/script/log/ia_start/ia_start.$GetDate&lt;BR /&gt;&lt;BR /&gt;echo "=====[Today is `date`] Application Start Script START...]=====" &amp;gt;&amp;gt; $LOG_NM&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;##------------------------ Oracle Start  -----------------------------&lt;BR /&gt;echo " Firstly, Start Oracle : `date` " &amp;gt;&amp;gt; $LOG_NM&lt;BR /&gt;</description>
      <pubDate>Thu, 13 Jan 2005 03:50:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/auto-trimming-of-log-files/m-p/3462223#M704003</guid>
      <dc:creator>Nguyen Anh Tien</dc:creator>
      <dc:date>2005-01-13T03:50:20Z</dc:date>
    </item>
    <item>
      <title>Re: Auto Trimming of log files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/auto-trimming-of-log-files/m-p/3462224#M704004</link>
      <description>Another way.&lt;BR /&gt;1, Create mark point for each lines by  this shell variable&lt;BR /&gt;GetDate=`date +"%d"`+"HenryChua"&lt;BR /&gt;2, at script you adding this variable to the end (or begin) OF each line.&lt;BR /&gt;3. at trimming script. you look for string:&lt;BR /&gt;30HenryChua and delete it.&lt;BR /&gt;tienna</description>
      <pubDate>Thu, 13 Jan 2005 03:59:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/auto-trimming-of-log-files/m-p/3462224#M704004</guid>
      <dc:creator>Nguyen Anh Tien</dc:creator>
      <dc:date>2005-01-13T03:59:51Z</dc:date>
    </item>
    <item>
      <title>Re: Auto Trimming of log files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/auto-trimming-of-log-files/m-p/3462225#M704005</link>
      <description>Hi,&lt;BR /&gt;I would suggest creating a directory and writing one file per day, based on the day of the month.&lt;BR /&gt;This will automatically overwrite your log from one month ago and is very is to analyse.&lt;BR /&gt;&lt;BR /&gt;./script &amp;gt; `date +"%d"`.log 2&amp;gt;&amp;amp;1&lt;BR /&gt;&lt;BR /&gt;Regards</description>
      <pubDate>Thu, 13 Jan 2005 04:15:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/auto-trimming-of-log-files/m-p/3462225#M704005</guid>
      <dc:creator>Peter Godron</dc:creator>
      <dc:date>2005-01-13T04:15:28Z</dc:date>
    </item>
    <item>
      <title>Re: Auto Trimming of log files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/auto-trimming-of-log-files/m-p/3462226#M704006</link>
      <description>the way i am using is to gzip the old file and remove after one month, the following actions run daily,&lt;BR /&gt;find $LOGDIR -name appllog\*.log -mtime +1 -exec /usr/contrib/bin/gzip {} \; &lt;BR /&gt;find $LOGDIR -name appllog\*.gz -mtime +31 -exec rm {} \;&lt;BR /&gt;</description>
      <pubDate>Thu, 13 Jan 2005 04:29:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/auto-trimming-of-log-files/m-p/3462226#M704006</guid>
      <dc:creator>twang</dc:creator>
      <dc:date>2005-01-13T04:29:16Z</dc:date>
    </item>
    <item>
      <title>Re: Auto Trimming of log files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/auto-trimming-of-log-files/m-p/3462227#M704007</link>
      <description>Rather than 'rm', ypu might want to do&lt;BR /&gt;&lt;BR /&gt;cat /dev/null &amp;gt; theLogFile&lt;BR /&gt;&lt;BR /&gt;right after the save.&lt;BR /&gt;&lt;BR /&gt;Some programs don't automatically create the log file if it isn't there.&lt;BR /&gt;&lt;BR /&gt;As the others said, it's a lot easier to save the whole log file every 30 days (or however often makes sense) and start a new one, than try to pull out lines.&lt;BR /&gt;&lt;BR /&gt;I usually save log file with names like&lt;BR /&gt;&lt;BR /&gt;wtmp2004_12.gz&lt;BR /&gt;</description>
      <pubDate>Fri, 14 Jan 2005 11:55:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/auto-trimming-of-log-files/m-p/3462227#M704007</guid>
      <dc:creator>Michael D. Zorn</dc:creator>
      <dc:date>2005-01-14T11:55:44Z</dc:date>
    </item>
    <item>
      <title>Re: Auto Trimming of log files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/auto-trimming-of-log-files/m-p/3462228#M704008</link>
      <description>I have used some thing like the script below for years.&lt;BR /&gt;&lt;BR /&gt;Organising archives directories named by month and year means that archives can be easily removed one month at a time.&lt;BR /&gt;_________________&lt;BR /&gt;&lt;BR /&gt;#!/bin/ksh&lt;BR /&gt;#&lt;BR /&gt;#       retarc - RETire and ARChive&lt;BR /&gt;#&lt;BR /&gt;#       files in the specified directory which are over a certain size are&lt;BR /&gt;#       1)      renamed to filename.date&lt;BR /&gt;#       2)      compressed&lt;BR /&gt;#&lt;BR /&gt;#       Author: Daavid June 1, 2000&lt;BR /&gt;&lt;BR /&gt;yearStr=`date +"%E"`&lt;BR /&gt;monthStr=`date +"%m"`&lt;BR /&gt;dayTimeStr=`date +"%d_%H_%M"`&lt;BR /&gt;archiveDir="archive"&lt;BR /&gt;dest=&lt;BR /&gt;&lt;BR /&gt;startDir=$1&lt;BR /&gt;&lt;BR /&gt;if test -z "$2"; then&lt;BR /&gt;        # 20 Mb&lt;BR /&gt;        minSize=20971520&lt;BR /&gt;else&lt;BR /&gt;        minSize=$2&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;if test -z "$startDir"; then&lt;BR /&gt;        echo "Usage : $0 dirName [minFileSize]"&lt;BR /&gt;        echo "   where dirName is the location of files to be retired and archived"&lt;BR /&gt;        echo "         minFileSize is the minimum file size in bytes to be processed."&lt;BR /&gt;        echo "          (default is $minSize bytes)"&lt;BR /&gt;else&lt;BR /&gt;        # Ok - time for action, first make sure the correct dir exists&lt;BR /&gt;        dest="${startDir}/$archiveDir"&lt;BR /&gt;        mkdir $dest &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&lt;BR /&gt;        dest="${dest}/$yearStr"&lt;BR /&gt;        mkdir $dest &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&lt;BR /&gt;        dest="${dest}/$monthStr"&lt;BR /&gt;        mkdir $dest &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&lt;BR /&gt;        for file in `ls $startDir`&lt;BR /&gt;        do&lt;BR /&gt;                if test -n {`echo $file | grep "\.Z\$"`} ; then&lt;BR /&gt;                        cd $startDir&lt;BR /&gt;                        if test -f $file ; then&lt;BR /&gt;                                size=`ls -sn1 $file | awk '{ print \$6 }'`&lt;BR /&gt;                                if (( $size &amp;gt; $minSize )) ; then&lt;BR /&gt;                                        cp $file $dest/$file.$dayTimeStr&lt;BR /&gt;                                        if (( $? == 0 ))&lt;BR /&gt;                                        then&lt;BR /&gt;                                        # 'zero' the original&lt;BR /&gt;                                                &amp;gt;$file&lt;BR /&gt;                                                compress $dest/$file.$dayTimeStr&lt;BR /&gt;                                        else&lt;BR /&gt;                                                echo "Copy Failed!"&lt;BR /&gt;                                        fi&lt;BR /&gt;                                fi&lt;BR /&gt;                        fi&lt;BR /&gt;                fi&lt;BR /&gt;        done&lt;BR /&gt;fi</description>
      <pubDate>Sun, 16 Jan 2005 17:03:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/auto-trimming-of-log-files/m-p/3462228#M704008</guid>
      <dc:creator>Daavid Turnbull</dc:creator>
      <dc:date>2005-01-16T17:03:22Z</dc:date>
    </item>
  </channel>
</rss>

