<?xml version="1.0" encoding="UTF-8"?><rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
> <channel><title>Comments on: Delete a log files in Linux or UNIX</title> <atom:link href="http://www.cyberciti.biz/faq/remove-log-files-in-linux-unix-bsd/feed/" rel="self" type="application/rss+xml" /><link>http://www.cyberciti.biz/faq/remove-log-files-in-linux-unix-bsd/</link> <description>Every answer asks a more beautiful question.</description> <lastBuildDate>Fri, 10 Feb 2012 19:55:56 +0000</lastBuildDate> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <item><title>By: Ajeet Jha</title><link>http://www.cyberciti.biz/faq/remove-log-files-in-linux-unix-bsd/#comment-49704</link> <dc:creator>Ajeet Jha</dc:creator> <pubDate>Fri, 24 Sep 2010 10:21:41 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/remove-log-files-in-linux-unix-bsd/#comment-49704</guid> <description>Use the following command:
suppose your file name is message.log then use:
echo &quot;&quot; &gt; message.log
This will empty the file without having deleting it.</description> <content:encoded><![CDATA[<p>Use the following command:</p><p>suppose your file name is message.log then use:</p><p>echo &#8220;&#8221; &gt; message.log</p><p>This will empty the file without having deleting it.</p> ]]></content:encoded> </item> <item><title>By: chandra</title><link>http://www.cyberciti.biz/faq/remove-log-files-in-linux-unix-bsd/#comment-39492</link> <dc:creator>chandra</dc:creator> <pubDate>Wed, 17 Dec 2008 07:35:50 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/remove-log-files-in-linux-unix-bsd/#comment-39492</guid> <description>simply wirte rm file.log and press enter</description> <content:encoded><![CDATA[<p>simply wirte rm file.log and press enter</p> ]]></content:encoded> </item> <item><title>By: dave</title><link>http://www.cyberciti.biz/faq/remove-log-files-in-linux-unix-bsd/#comment-36678</link> <dc:creator>dave</dc:creator> <pubDate>Mon, 23 Jul 2007 16:42:39 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/remove-log-files-in-linux-unix-bsd/#comment-36678</guid> <description>Thank you for pointing me in the right direction. I&#039;ve been doing some more research and had another question if you wouldn&#039;t mine throwing in some input.
I want to remove apache logs after about a month. So I was going to set something up like this that I found online.
This is an example of a /etc/logrotate.d/httpd
/var/log/httpd/*.log {
daily
rotate 30
missingok
notifempty
sharedscripts
postrotate
/bin/kill -HUP `cat /var/run/httpd.pid 2&gt;/dev/null` 2&gt; /dev/null &#124;&#124; true    endscript
}
Now from what I understand this will rotate the log daily meaning create a new log everyday. The 30 means that it will hold 30 of these logs before deleting them (or compressing if I put that option in there)
Also, before I go and set this up, I want to test it on 1 websites log incase I mess things up. Would it be ok to replace the line
/var/log/httpd/*.log
with
/var/log/httpd/&quot;website&quot;*.log to that affect to test in one website before doing all of them?
Does it sound like I&#039;m on the right track or am I completely lost :) thanks again for your input.</description> <content:encoded><![CDATA[<p>Thank you for pointing me in the right direction. I&#8217;ve been doing some more research and had another question if you wouldn&#8217;t mine throwing in some input.</p><p>I want to remove apache logs after about a month. So I was going to set something up like this that I found online.</p><p>This is an example of a /etc/logrotate.d/httpd</p><p>/var/log/httpd/*.log {<br
/> daily<br
/> rotate 30<br
/> missingok<br
/> notifempty<br
/> sharedscripts<br
/> postrotate<br
/> /bin/kill -HUP `cat /var/run/httpd.pid 2&gt;/dev/null` 2&gt; /dev/null || true    endscript<br
/> }</p><p>Now from what I understand this will rotate the log daily meaning create a new log everyday. The 30 means that it will hold 30 of these logs before deleting them (or compressing if I put that option in there)</p><p>Also, before I go and set this up, I want to test it on 1 websites log incase I mess things up. Would it be ok to replace the line</p><p>/var/log/httpd/*.log<br
/> with<br
/> /var/log/httpd/&#8221;website&#8221;*.log to that affect to test in one website before doing all of them?</p><p>Does it sound like I&#8217;m on the right track or am I completely lost :) thanks again for your input.</p> ]]></content:encoded> </item> <item><title>By: vivek</title><link>http://www.cyberciti.biz/faq/remove-log-files-in-linux-unix-bsd/#comment-36672</link> <dc:creator>vivek</dc:creator> <pubDate>Thu, 19 Jul 2007 20:49:33 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/remove-log-files-in-linux-unix-bsd/#comment-36672</guid> <description>There are 2 options, either use log logrotate or use find command to get list of 2 days old files and empty them. You can find information about logrotate  and about find command here only. Use search box to get information</description> <content:encoded><![CDATA[<p>There are 2 options, either use log logrotate or use find command to get list of 2 days old files and empty them. You can find information about logrotate  and about find command here only. Use search box to get information</p> ]]></content:encoded> </item> <item><title>By: dave</title><link>http://www.cyberciti.biz/faq/remove-log-files-in-linux-unix-bsd/#comment-36670</link> <dc:creator>dave</dc:creator> <pubDate>Thu, 19 Jul 2007 15:23:23 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/remove-log-files-in-linux-unix-bsd/#comment-36670</guid> <description>How would you specify to delete log that are over a certain age. ie 2days old or something like that. Thanks for the help.</description> <content:encoded><![CDATA[<p>How would you specify to delete log that are over a certain age. ie 2days old or something like that. Thanks for the help.</p> ]]></content:encoded> </item> <item><title>By: vivek</title><link>http://www.cyberciti.biz/faq/remove-log-files-in-linux-unix-bsd/#comment-36568</link> <dc:creator>vivek</dc:creator> <pubDate>Sat, 16 Jun 2007 13:31:26 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/remove-log-files-in-linux-unix-bsd/#comment-36568</guid> <description>/var/log is directory, if you delete the same just recreate directory using mkdir command:
[code]mkdir /var/log[/code]</description> <content:encoded><![CDATA[<p>/var/log is directory, if you delete the same just recreate directory using mkdir command:<br
/> [code]mkdir /var/log[/code]</p> ]]></content:encoded> </item> <item><title>By: vb</title><link>http://www.cyberciti.biz/faq/remove-log-files-in-linux-unix-bsd/#comment-36567</link> <dc:creator>vb</dc:creator> <pubDate>Sat, 16 Jun 2007 03:39:21 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/remove-log-files-in-linux-unix-bsd/#comment-36567</guid> <description>my log files /var/log deleted is it creates any problem</description> <content:encoded><![CDATA[<p>my log files /var/log deleted is it creates any problem</p> ]]></content:encoded> </item> </channel> </rss>
