<?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: Trim Active Log in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/trim-active-log/m-p/4984342#M782810</link>
    <description>Hi Susee.&lt;BR /&gt;#/dev/null &amp;gt; log_file&lt;BR /&gt;and &lt;BR /&gt;# &amp;gt; log_file&lt;BR /&gt;both will re-fresh your logfile with no data inside (make the log file empty) but keep the time-stamp of that file ( day of creation, owner, permission)&lt;BR /&gt;By do-ing as this way. Your application can continue to put log to log-file as usual.&lt;BR /&gt;HTH</description>
    <pubDate>Mon, 12 Jun 2006 02:47:39 GMT</pubDate>
    <dc:creator>Nguyen Anh Tien</dc:creator>
    <dc:date>2006-06-12T02:47:39Z</dc:date>
    <item>
      <title>Trim Active Log</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/trim-active-log/m-p/4984328#M782796</link>
      <description>Hi ,&lt;BR /&gt;&lt;BR /&gt;How can I trim my active log file ..</description>
      <pubDate>Fri, 09 Jun 2006 07:11:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/trim-active-log/m-p/4984328#M782796</guid>
      <dc:creator>susee_sundar</dc:creator>
      <dc:date>2006-06-09T07:11:16Z</dc:date>
    </item>
    <item>
      <title>Re: Trim Active Log</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/trim-active-log/m-p/4984329#M782797</link>
      <description>cat /dev/null &amp;gt; my_active_log_file&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Pete</description>
      <pubDate>Fri, 09 Jun 2006 07:16:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/trim-active-log/m-p/4984329#M782797</guid>
      <dc:creator>Pete Randall</dc:creator>
      <dc:date>2006-06-09T07:16:02Z</dc:date>
    </item>
    <item>
      <title>Re: Trim Active Log</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/trim-active-log/m-p/4984330#M782798</link>
      <description>There are a lot of different logs.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;A good way is to use the "guided" function with SAM.</description>
      <pubDate>Fri, 09 Jun 2006 07:16:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/trim-active-log/m-p/4984330#M782798</guid>
      <dc:creator>Torsten.</dc:creator>
      <dc:date>2006-06-09T07:16:32Z</dc:date>
    </item>
    <item>
      <title>Re: Trim Active Log</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/trim-active-log/m-p/4984331#M782799</link>
      <description>Hi;&lt;BR /&gt;I have a nice script that trims/archives syslog.log while managing syslogd. If interested, respond and I will send you the complete script. You could modify it for other log files.&lt;BR /&gt;&lt;BR /&gt;Matthew from Boston</description>
      <pubDate>Sun, 11 Jun 2006 08:23:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/trim-active-log/m-p/4984331#M782799</guid>
      <dc:creator>Matthew Ghofrani</dc:creator>
      <dc:date>2006-06-11T08:23:17Z</dc:date>
    </item>
    <item>
      <title>Re: Trim Active Log</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/trim-active-log/m-p/4984332#M782800</link>
      <description>The preferred way is to trim files using sam,&lt;BR /&gt;# sam &lt;BR /&gt;Routine Tasks --&amp;gt; System Log Files &lt;BR /&gt;then select the log file to trim.&lt;BR /&gt;&lt;BR /&gt;else following command can be used:&lt;BR /&gt;&lt;BR /&gt;cat /dev/null &amp;gt;  &lt;LOG file="" name=""&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/LOG&gt;</description>
      <pubDate>Sun, 11 Jun 2006 08:39:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/trim-active-log/m-p/4984332#M782800</guid>
      <dc:creator>Mridul Shrivastava</dc:creator>
      <dc:date>2006-06-11T08:39:42Z</dc:date>
    </item>
    <item>
      <title>Re: Trim Active Log</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/trim-active-log/m-p/4984333#M782801</link>
      <description>The simplest method is to use sam as it understands most of the common logfiles. However, the manual method is:&lt;BR /&gt; &lt;BR /&gt;cd /logfile_directory&lt;BR /&gt;cp logfile logfile.old&lt;BR /&gt;cat /dev/null &amp;gt; logfile&lt;BR /&gt; &lt;BR /&gt;Do not rename the file or create a new one since the file may be in use by a program. The above method allows for a program to continue adding to the logfile.&lt;BR /&gt; &lt;BR /&gt;Logfile trimming is a regular task and will have to be repeated. Of course, the logfiles should be examined for any problems.</description>
      <pubDate>Sun, 11 Jun 2006 20:25:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/trim-active-log/m-p/4984333#M782801</guid>
      <dc:creator>Bill Hassell</dc:creator>
      <dc:date>2006-06-11T20:25:46Z</dc:date>
    </item>
    <item>
      <title>Re: Trim Active Log</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/trim-active-log/m-p/4984334#M782802</link>
      <description>1, backup your current log file for  later refer&lt;BR /&gt;#cp /path/your_log_file /path/backup_file&lt;BR /&gt;2, Trim&lt;BR /&gt;#&amp;gt;/path/your_log_file&lt;BR /&gt;HTH</description>
      <pubDate>Sun, 11 Jun 2006 21:32:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/trim-active-log/m-p/4984334#M782802</guid>
      <dc:creator>Nguyen Anh Tien</dc:creator>
      <dc:date>2006-06-11T21:32:46Z</dc:date>
    </item>
    <item>
      <title>Re: Trim Active Log</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/trim-active-log/m-p/4984335#M782803</link>
      <description>Hi I got a good idea in trimming the log file.&lt;BR /&gt;&lt;BR /&gt;But few doupts.&lt;BR /&gt;&lt;BR /&gt;#/dev/null &amp;gt; active_log_file&lt;BR /&gt;&lt;BR /&gt;What the command is doing.?&lt;BR /&gt;How it is trimming the log file.?&lt;BR /&gt;&lt;BR /&gt;As per my Knowledge it is sending the content of active log to the null port ..If so.. Then how the Log file is get trimmed..&lt;BR /&gt;&lt;BR /&gt;I got confused .. Anybody here to clear this confusion..</description>
      <pubDate>Mon, 12 Jun 2006 00:00:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/trim-active-log/m-p/4984335#M782803</guid>
      <dc:creator>susee_sundar</dc:creator>
      <dc:date>2006-06-12T00:00:49Z</dc:date>
    </item>
    <item>
      <title>Re: Trim Active Log</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/trim-active-log/m-p/4984336#M782804</link>
      <description>Hi Sundar, &lt;BR /&gt;&lt;BR /&gt;But few doupts.&lt;BR /&gt;&lt;BR /&gt;#/dev/null &amp;gt; active_log_file&lt;BR /&gt;&lt;BR /&gt;What the command is doing.? &lt;BR /&gt;This command nullifies the active_log_file. &lt;BR /&gt;How it is trimming the log file.?&lt;BR /&gt;&lt;BR /&gt;As per my Knowledge it is sending the content of active log to the null port ..If so.. Then how the Log file is get trimmed..&lt;BR /&gt;&lt;BR /&gt;Take a look at # man null &lt;BR /&gt;&lt;BR /&gt; NAME&lt;BR /&gt;      null - null file&lt;BR /&gt;&lt;BR /&gt; DESCRIPTION&lt;BR /&gt;      Data written on a null special file is discarded.&lt;BR /&gt;&lt;BR /&gt;      Reads from a null special file always return 0 bytes.&lt;BR /&gt;&lt;BR /&gt; EXAMPLES&lt;BR /&gt;      To create a zero-length file, use either of the following:&lt;BR /&gt;&lt;BR /&gt;           cat /dev/null &amp;gt; file&lt;BR /&gt;           cp /dev/null file&lt;BR /&gt;&lt;BR /&gt;-Arun</description>
      <pubDate>Mon, 12 Jun 2006 00:12:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/trim-active-log/m-p/4984336#M782804</guid>
      <dc:creator>Arunvijai_4</dc:creator>
      <dc:date>2006-06-12T00:12:34Z</dc:date>
    </item>
    <item>
      <title>Re: Trim Active Log</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/trim-active-log/m-p/4984337#M782805</link>
      <description>&lt;BR /&gt;#/dev/null &amp;gt; active_log_file&lt;BR /&gt;&lt;BR /&gt;What the command is doing.?&lt;BR /&gt;This command nullifies the active_log_file.&lt;BR /&gt;&lt;BR /&gt;SUCH THAT THE ACTIVE LOG FILE CONTENT WILL BE ERASED IS IT SO...&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 12 Jun 2006 00:38:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/trim-active-log/m-p/4984337#M782805</guid>
      <dc:creator>susee_sundar</dc:creator>
      <dc:date>2006-06-12T00:38:17Z</dc:date>
    </item>
    <item>
      <title>Re: Trim Active Log</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/trim-active-log/m-p/4984338#M782806</link>
      <description>Yes, Thats correct. # &amp;gt;file is efficient way of doing. &lt;BR /&gt;&lt;BR /&gt;-Arun</description>
      <pubDate>Mon, 12 Jun 2006 00:40:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/trim-active-log/m-p/4984338#M782806</guid>
      <dc:creator>Arunvijai_4</dc:creator>
      <dc:date>2006-06-12T00:40:52Z</dc:date>
    </item>
    <item>
      <title>Re: Trim Active Log</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/trim-active-log/m-p/4984339#M782807</link>
      <description>i replied this around yesterday night, but something wrong... and i am repling again.&lt;BR /&gt;==========================================&lt;BR /&gt;i have some questions about /dev/null:&lt;BR /&gt;&lt;BR /&gt;from man null:&lt;BR /&gt;Data written on a null special file is discarded.&lt;BR /&gt;Reads from a null special file always return 0 bytes.&lt;BR /&gt;&lt;BR /&gt;To create a zero-length file, use either of the following:&lt;BR /&gt;&lt;BR /&gt;           cat /dev/null &amp;gt; file&lt;BR /&gt;           cp /dev/null file&lt;BR /&gt;&lt;BR /&gt;#ll null&lt;BR /&gt;crw-rw-rw-   1 bin        bin          3 0x000002 Jun 12 01:15 null&lt;BR /&gt;#wc null&lt;BR /&gt;0 0 0 null&lt;BR /&gt;&lt;BR /&gt;1.)i thought that /dev/null is a exe like rm or cat, but its a charactor special file.&lt;BR /&gt;anyhow its size also, zero. then how it is working? &lt;BR /&gt;2.) cat /dev/null &amp;gt; my_active_log_file &lt;BR /&gt;this command will delete the content of that "my_active_log_file". if so, &lt;BR /&gt;#rm my_active_log_file&lt;BR /&gt;#touch my_active_log_file also do the same function..right?&lt;BR /&gt;&lt;BR /&gt;3). thru sam, we can do:&lt;BR /&gt; 1. trim to zero, 2. To the Recommended size, 3. To a Line Number 4. To a Percentage, &lt;BR /&gt;&lt;BR /&gt;how to do this four things thru commands?&lt;BR /&gt;ie how to trim a file to its 50% of original size?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 12 Jun 2006 01:49:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/trim-active-log/m-p/4984339#M782807</guid>
      <dc:creator>inventsekar_1</dc:creator>
      <dc:date>2006-06-12T01:49:51Z</dc:date>
    </item>
    <item>
      <title>Re: Trim Active Log</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/trim-active-log/m-p/4984340#M782808</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Sekar FYI,&lt;BR /&gt;&lt;BR /&gt;#cat /dev/null &amp;gt;file&lt;BR /&gt;or&lt;BR /&gt;#&amp;gt;file&lt;BR /&gt;&lt;BR /&gt;Will do the same thing.&lt;BR /&gt;&lt;BR /&gt;Also it is the efficient way of trimming the log files. Allthough you can do it by other ways as well like removing and recreating files. But it will also involve two more steps of changing ownerships and permissions.&lt;BR /&gt;Also if some process tries to access the same while while you have removed it, it may experience some error. &lt;BR /&gt;&lt;BR /&gt;So why to follow these many steps when you can do it with one simple commands itself.&lt;BR /&gt;&lt;BR /&gt;HTH,&lt;BR /&gt;Devender</description>
      <pubDate>Mon, 12 Jun 2006 02:15:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/trim-active-log/m-p/4984340#M782808</guid>
      <dc:creator>Devender Khatana</dc:creator>
      <dc:date>2006-06-12T02:15:39Z</dc:date>
    </item>
    <item>
      <title>Re: Trim Active Log</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/trim-active-log/m-p/4984341#M782809</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I think That I got something But not sure.,&lt;BR /&gt;From the above reply that i find that &lt;BR /&gt;&lt;BR /&gt;We can take the log file backup by using cp &lt;BR /&gt;&lt;BR /&gt;#cp log_file log_file_old&lt;BR /&gt;&lt;BR /&gt;then we can forwrd it to the null port such that &lt;BR /&gt;&lt;BR /&gt;#/dev/null &amp;gt; log_file&lt;BR /&gt;&lt;BR /&gt;such that the log_file become empty..&lt;BR /&gt;&lt;BR /&gt;Is it right..&lt;BR /&gt;&lt;BR /&gt;1. If so then what will happen to the new logs.. ?&lt;BR /&gt;&lt;BR /&gt;2. And how the log file start generating logs again.. ?&lt;BR /&gt;</description>
      <pubDate>Mon, 12 Jun 2006 02:41:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/trim-active-log/m-p/4984341#M782809</guid>
      <dc:creator>susee_sundar</dc:creator>
      <dc:date>2006-06-12T02:41:42Z</dc:date>
    </item>
    <item>
      <title>Re: Trim Active Log</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/trim-active-log/m-p/4984342#M782810</link>
      <description>Hi Susee.&lt;BR /&gt;#/dev/null &amp;gt; log_file&lt;BR /&gt;and &lt;BR /&gt;# &amp;gt; log_file&lt;BR /&gt;both will re-fresh your logfile with no data inside (make the log file empty) but keep the time-stamp of that file ( day of creation, owner, permission)&lt;BR /&gt;By do-ing as this way. Your application can continue to put log to log-file as usual.&lt;BR /&gt;HTH</description>
      <pubDate>Mon, 12 Jun 2006 02:47:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/trim-active-log/m-p/4984342#M782810</guid>
      <dc:creator>Nguyen Anh Tien</dc:creator>
      <dc:date>2006-06-12T02:47:39Z</dc:date>
    </item>
    <item>
      <title>Re: Trim Active Log</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/trim-active-log/m-p/4984343#M782811</link>
      <description>Hi ,&lt;BR /&gt;&lt;BR /&gt;Its Amazing  Response and i Got The solution from the last reply..&lt;BR /&gt;&lt;BR /&gt;Thanks to All..&lt;BR /&gt; &lt;BR /&gt;I am closing the Thread.</description>
      <pubDate>Mon, 12 Jun 2006 02:52:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/trim-active-log/m-p/4984343#M782811</guid>
      <dc:creator>susee_sundar</dc:creator>
      <dc:date>2006-06-12T02:52:53Z</dc:date>
    </item>
    <item>
      <title>Re: Trim Active Log</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/trim-active-log/m-p/4984344#M782812</link>
      <description>Sundar,&lt;BR /&gt;&lt;BR /&gt;There are quite a few ways to trim a file under HP-UX as in...&lt;BR /&gt;&lt;BR /&gt;# &amp;gt; active_log_file&lt;BR /&gt;or&lt;BR /&gt;# cat /dev/null &amp;gt; active_log_file&lt;BR /&gt;or&lt;BR /&gt;# cp /dev/null active_log_file&lt;BR /&gt;or&lt;BR /&gt;SAM&lt;BR /&gt;&lt;BR /&gt;...SAM is able to manipulate the file size in more ways because behind the scenes it calls the std C lib APIs like truncate and ftruncate.&lt;BR /&gt;&lt;BR /&gt;You can develop your own C program(s) utilizing those lib routines and wrap them in a menu driven shell script which essentially provides the same functionality as SAM does.&lt;BR /&gt;&lt;BR /&gt;~hope it helps</description>
      <pubDate>Mon, 12 Jun 2006 02:54:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/trim-active-log/m-p/4984344#M782812</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2006-06-12T02:54:36Z</dc:date>
    </item>
    <item>
      <title>Re: Trim Active Log</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/trim-active-log/m-p/4984345#M782813</link>
      <description>Hi,&lt;BR /&gt;you could use logrotate:&lt;BR /&gt;&lt;A href="http://forums1.itrc.hp.com/service/forums/bizsupport/questionanswer.do?threadId=686249" target="_blank"&gt;http://forums1.itrc.hp.com/service/forums/bizsupport/questionanswer.do?threadId=686249&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;HTH,&lt;BR /&gt;Art</description>
      <pubDate>Mon, 12 Jun 2006 03:08:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/trim-active-log/m-p/4984345#M782813</guid>
      <dc:creator>Arturo Galbiati</dc:creator>
      <dc:date>2006-06-12T03:08:37Z</dc:date>
    </item>
    <item>
      <title>Re: Trim Active Log</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/trim-active-log/m-p/4984346#M782814</link>
      <description>Very important:&lt;BR /&gt; &lt;BR /&gt;/dev/null can be used to write or read. When it is used as a source file, it is an empty file. When you simply cat the null file and redirect it into another file, the destination file is reduced to zero length. This is *NOT* the same as:&lt;BR /&gt; &lt;BR /&gt;rm logfile&lt;BR /&gt;touch logfile&lt;BR /&gt; &lt;BR /&gt;Several mistakes have occurred using rm. First, the logfile has very specific permissions and removing the file means that these permissions and ownership must be restored for proper operation. Now if the logfile is still open, then the rm does not work correctly and the touch simply updates the timestamp. DON'T use rm.&lt;BR /&gt; &lt;BR /&gt;Trimming a logfile to 50% requires a script to calculate the number of records, read that many records from the start into the second logfile. Then using tail (it has limitations on size) or awk, read the last half into a temp file, then cp the tempfile on top of the current file and delete the tempfile. Not easy at all. It is much simpler to copy the current file then zero the current file.</description>
      <pubDate>Mon, 12 Jun 2006 06:48:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/trim-active-log/m-p/4984346#M782814</guid>
      <dc:creator>Bill Hassell</dc:creator>
      <dc:date>2006-06-12T06:48:05Z</dc:date>
    </item>
  </channel>
</rss>

