<?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>question Re: How to delete log folder faster having files lots of file and heavy log folder in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-delete-log-folder-faster-having-files-lots-of-file/m-p/136430#M43812</link>
    <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/75/vpemawat.html" nodeid="75"&gt;@vpemawat&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;If you are not using log4j: &lt;/STRONG&gt;If you are looking to delete the files for good then there is not many options available other than rm -rf; however there are few tweaks that you can do to make it faster &lt;/P&gt;&lt;OL&gt;&lt;LI&gt;you can perhaps run multiple rm scripts in parallel (multiple threads)&lt;/LI&gt;&lt;LI&gt;In order to do this, you should be able to logically separate the log files either by folder or name format&lt;/LI&gt;&lt;LI&gt;Once you have done that, you can run multiple rm commands in background like something below&lt;/LI&gt;&lt;/OL&gt;&lt;PRE&gt;nohup rm -fr app1-2016* &amp;gt; /tmp/nohup.out 2&amp;gt;&amp;amp;1 &amp;amp;
nohup rm -fr app1-2015* &amp;gt; /tmp/nohup.out 2&amp;gt;&amp;amp;1 &amp;amp;&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;If using log4j:&lt;/STRONG&gt; You should probably be 'DailyRollingFileAppender" with 'maxBackupIndex' - this will essentially limit the max file size of your log and then purge the older contents. More details here: &lt;A target="_blank" href="http://www.codeproject.com/Articles/81462/DailyRollingFileAppender-with-maxBackupIndex"&gt;http://www.codeproject.com/Articles/81462/DailyRollingFileAppender-with-maxBackupIndex&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Outside of this, you should consider the below 2 things for future use cases&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Organize the logs by folder (normally broken down like /logs/appname/yyyy/mm/dd/hh/&amp;lt;log files&amp;gt;&lt;/LI&gt;&lt;LI&gt;Have a mechanism that will either delete the old log files, or archive it to a different log archive server&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;Hopefully this helps. If it does, please '&lt;STRONG&gt;accept&lt;/STRONG&gt;' and '&lt;STRONG&gt;upvote&lt;/STRONG&gt;' the answer. Thank you!!&lt;/P&gt;</description>
    <pubDate>Tue, 18 Oct 2016 22:36:40 GMT</pubDate>
    <dc:creator>hduraiswamy</dc:creator>
    <dc:date>2016-10-18T22:36:40Z</dc:date>
    <item>
      <title>How to delete log folder faster having files lots of file and heavy log folder</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-delete-log-folder-faster-having-files-lots-of-file/m-p/136429#M43811</link>
      <description>&lt;P&gt;Problem : Deletion of log folder with below details&lt;/P&gt;&lt;P&gt;Log size is around 10gb&lt;/P&gt;&lt;P&gt;No . of files around 9k files.&lt;/P&gt;&lt;P&gt;Simple rm -rf  log folder  doesn't works well.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Oct 2016 17:43:17 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-delete-log-folder-faster-having-files-lots-of-file/m-p/136429#M43811</guid>
      <dc:creator>vpemawat</dc:creator>
      <dc:date>2016-10-18T17:43:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete log folder faster having files lots of file and heavy log folder</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-delete-log-folder-faster-having-files-lots-of-file/m-p/136430#M43812</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/75/vpemawat.html" nodeid="75"&gt;@vpemawat&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;If you are not using log4j: &lt;/STRONG&gt;If you are looking to delete the files for good then there is not many options available other than rm -rf; however there are few tweaks that you can do to make it faster &lt;/P&gt;&lt;OL&gt;&lt;LI&gt;you can perhaps run multiple rm scripts in parallel (multiple threads)&lt;/LI&gt;&lt;LI&gt;In order to do this, you should be able to logically separate the log files either by folder or name format&lt;/LI&gt;&lt;LI&gt;Once you have done that, you can run multiple rm commands in background like something below&lt;/LI&gt;&lt;/OL&gt;&lt;PRE&gt;nohup rm -fr app1-2016* &amp;gt; /tmp/nohup.out 2&amp;gt;&amp;amp;1 &amp;amp;
nohup rm -fr app1-2015* &amp;gt; /tmp/nohup.out 2&amp;gt;&amp;amp;1 &amp;amp;&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;If using log4j:&lt;/STRONG&gt; You should probably be 'DailyRollingFileAppender" with 'maxBackupIndex' - this will essentially limit the max file size of your log and then purge the older contents. More details here: &lt;A target="_blank" href="http://www.codeproject.com/Articles/81462/DailyRollingFileAppender-with-maxBackupIndex"&gt;http://www.codeproject.com/Articles/81462/DailyRollingFileAppender-with-maxBackupIndex&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Outside of this, you should consider the below 2 things for future use cases&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Organize the logs by folder (normally broken down like /logs/appname/yyyy/mm/dd/hh/&amp;lt;log files&amp;gt;&lt;/LI&gt;&lt;LI&gt;Have a mechanism that will either delete the old log files, or archive it to a different log archive server&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;Hopefully this helps. If it does, please '&lt;STRONG&gt;accept&lt;/STRONG&gt;' and '&lt;STRONG&gt;upvote&lt;/STRONG&gt;' the answer. Thank you!!&lt;/P&gt;</description>
      <pubDate>Tue, 18 Oct 2016 22:36:40 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-delete-log-folder-faster-having-files-lots-of-file/m-p/136430#M43812</guid>
      <dc:creator>hduraiswamy</dc:creator>
      <dc:date>2016-10-18T22:36:40Z</dc:date>
    </item>
  </channel>
</rss>

