{"id":194,"date":"2010-11-04T10:04:41","date_gmt":"2010-11-04T18:04:41","guid":{"rendered":"https:\/\/digitalcardboard.com\/blog\/?p=194"},"modified":"2011-01-19T16:37:33","modified_gmt":"2011-01-20T00:37:33","slug":"adding-rails-log-rotation-to-dreamhost-compiling-logrotate","status":"publish","type":"post","link":"https:\/\/digitalcardboard.com\/blog\/2010\/11\/04\/adding-rails-log-rotation-to-dreamhost-compiling-logrotate\/","title":{"rendered":"Adding Rails log rotation to Dreamhost (compiling your own logrotate)"},"content":{"rendered":"<p>(credit goes to <a href=\"http:\/\/blog.joeygeiger.com\/2010\/05\/21\/adding-rails-log-rotation-to-dreamhost\/\" target=\"_blank\">Joey Geiger<\/a> for the original <a href=\"https:\/\/gist.github.com\/409285\" target=\"_blank\">Gist<\/a>)<\/p>\n<p>Trying to use <em>logrotate<\/em> to rotate your Rails logs on Dreamhost? \u00a0 You&#8217;ll need to roll your own copy of it. \u00a0Fortunately, the process isn&#8217;t too bad. \u00a0Let&#8217;s jump right into it.<\/p>\n<p>SSH to your host and run the following commands (read my notes below if you&#8217;re not super gusty):<\/p>\n<p><script src=\"https:\/\/gist.github.com\/662603.js\"><\/script><noscript><pre><code class=\"language- \"># create a new cron job (crontab -e) or use panel.dreamhost.com and run it daily\n0 0 * * * \/home\/&lt;your_account&gt;\/opt\/bin\/logrotate -f -s \/home\/&lt;your_account&gt;\/opt\/lib\/logrotate.status \/home\/&lt;your_account&gt;\/opt\/etc\/logrotate.conf<\/code><\/pre><pre><code class=\"language-shell shell\">cd ~\nmkdir -p opt\/bin\nmkdir opt\/lib\nmkdir opt\/etc\nmkdir src\ncd src\nwget http:\/\/www.sfr-fresh.com\/unix\/privat\/logrotate-3.7.9.tar.gz\nwget http:\/\/www.sfr-fresh.com\/linux\/misc\/popt-1.16.tar.gz\ntar xzvf logrotate-3.7.9.tar.gz\ntar xzvf popt-1.16.tar.gz\ncd popt-1.16\n.\/configure --prefix=\/home\/&lt;your_account&gt;\/opt\/\nmake\nmake install\ncd ..\/logrotate-3.7.9\n# the first make will fail on the final compile (with &#039;cannot find -lpopt&#039; message)\n# some include problem, but this works so i&#039;m not inclined to care too much\nmake POPT_DIR=\/home\/&lt;your_account&gt;\/opt\/include\n# this make should complete\nmake POPT_DIR=\/home\/&lt;your_account&gt;\/opt\/lib\ncp logrotate ~\/opt\/bin\/\ncd ~\/opt\/etc\nvi logrotate.conf\n# paste in the logrotate.conf file<\/code><\/pre><pre><code class=\"language- \">\/home\/&lt;your_account&gt;\/&lt;your_website&gt;\/shared\/log\/*.log {\n  daily\n  missingok\n  rotate 7\n  compress\n  delaycompress\n  notifempty\n  copytruncate\n}<\/code><\/pre><\/noscript><br \/>\n<script src=\"https:\/\/gist.github.com\/662603.js\"><\/script><noscript><pre><code class=\"language- \"># create a new cron job (crontab -e) or use panel.dreamhost.com and run it daily\n0 0 * * * \/home\/&lt;your_account&gt;\/opt\/bin\/logrotate -f -s \/home\/&lt;your_account&gt;\/opt\/lib\/logrotate.status \/home\/&lt;your_account&gt;\/opt\/etc\/logrotate.conf<\/code><\/pre><pre><code class=\"language-shell shell\">cd ~\nmkdir -p opt\/bin\nmkdir opt\/lib\nmkdir opt\/etc\nmkdir src\ncd src\nwget http:\/\/www.sfr-fresh.com\/unix\/privat\/logrotate-3.7.9.tar.gz\nwget http:\/\/www.sfr-fresh.com\/linux\/misc\/popt-1.16.tar.gz\ntar xzvf logrotate-3.7.9.tar.gz\ntar xzvf popt-1.16.tar.gz\ncd popt-1.16\n.\/configure --prefix=\/home\/&lt;your_account&gt;\/opt\/\nmake\nmake install\ncd ..\/logrotate-3.7.9\n# the first make will fail on the final compile (with &#039;cannot find -lpopt&#039; message)\n# some include problem, but this works so i&#039;m not inclined to care too much\nmake POPT_DIR=\/home\/&lt;your_account&gt;\/opt\/include\n# this make should complete\nmake POPT_DIR=\/home\/&lt;your_account&gt;\/opt\/lib\ncp logrotate ~\/opt\/bin\/\ncd ~\/opt\/etc\nvi logrotate.conf\n# paste in the logrotate.conf file<\/code><\/pre><pre><code class=\"language- \">\/home\/&lt;your_account&gt;\/&lt;your_website&gt;\/shared\/log\/*.log {\n  daily\n  missingok\n  rotate 7\n  compress\n  delaycompress\n  notifempty\n  copytruncate\n}<\/code><\/pre><\/noscript><br \/>\n<script src=\"https:\/\/gist.github.com\/662603.js\"><\/script><noscript><pre><code class=\"language- \"># create a new cron job (crontab -e) or use panel.dreamhost.com and run it daily\n0 0 * * * \/home\/&lt;your_account&gt;\/opt\/bin\/logrotate -f -s \/home\/&lt;your_account&gt;\/opt\/lib\/logrotate.status \/home\/&lt;your_account&gt;\/opt\/etc\/logrotate.conf<\/code><\/pre><pre><code class=\"language-shell shell\">cd ~\nmkdir -p opt\/bin\nmkdir opt\/lib\nmkdir opt\/etc\nmkdir src\ncd src\nwget http:\/\/www.sfr-fresh.com\/unix\/privat\/logrotate-3.7.9.tar.gz\nwget http:\/\/www.sfr-fresh.com\/linux\/misc\/popt-1.16.tar.gz\ntar xzvf logrotate-3.7.9.tar.gz\ntar xzvf popt-1.16.tar.gz\ncd popt-1.16\n.\/configure --prefix=\/home\/&lt;your_account&gt;\/opt\/\nmake\nmake install\ncd ..\/logrotate-3.7.9\n# the first make will fail on the final compile (with &#039;cannot find -lpopt&#039; message)\n# some include problem, but this works so i&#039;m not inclined to care too much\nmake POPT_DIR=\/home\/&lt;your_account&gt;\/opt\/include\n# this make should complete\nmake POPT_DIR=\/home\/&lt;your_account&gt;\/opt\/lib\ncp logrotate ~\/opt\/bin\/\ncd ~\/opt\/etc\nvi logrotate.conf\n# paste in the logrotate.conf file<\/code><\/pre><pre><code class=\"language- \">\/home\/&lt;your_account&gt;\/&lt;your_website&gt;\/shared\/log\/*.log {\n  daily\n  missingok\n  rotate 7\n  compress\n  delaycompress\n  notifempty\n  copytruncate\n}<\/code><\/pre><\/noscript><\/p>\n<p>A couple of quick notes here:<\/p>\n<ul>The most substantial difference from <a href=\"http:\/\/blog.joeygeiger.com\/2010\/05\/21\/adding-rails-log-rotation-to-dreamhost\/\">jgeiger&#8217;s post<\/a> is the compiling of the <em>popt<\/em> library, so that in turn, <em>logrotate<\/em> would compile. \u00a0I really don&#8217;t know what&#8217;s messed up when you try to link to <em>popt<\/em> (which leads to the compile failing the first time around), but the workaround seems to work just fine. \u00a0If someone happens to know what magic flags are necessary to get the compile to work smoothly the first time, please fork the notes and let me know.<\/ul>\n<ul><em>Joe&#8217;s Own Editor<\/em> was the default editor when I tried to edit my crontab, and it makes my brain hurt. \u00a0Edit your <strong>.bash_profile<\/strong> and add <code>export EDITOR=\"\/usr\/bin\/vim\"<\/code> to use <em>vim<\/em> instead. Logout and back in for the change to take effect.<\/ul>\n<p><em>(disclaimer: Don&#8217;t break your stuff. Or Dreamhost&#8217;s stuff.)<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>(credit goes to Joey Geiger for the original Gist) Trying to use logrotate to rotate your Rails logs on Dreamhost? \u00a0 You&#8217;ll need to roll your own copy of it. \u00a0Fortunately, the process isn&#8217;t too bad. \u00a0Let&#8217;s jump right into it. SSH to your host and run the following commands (read my notes below if [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[29],"tags":[35,34,36,33],"class_list":["post-194","post","type-post","status-publish","format-standard","hentry","category-system-administration","tag-compile","tag-dreamhost","tag-logrotate","tag-rails"],"_links":{"self":[{"href":"https:\/\/digitalcardboard.com\/blog\/wp-json\/wp\/v2\/posts\/194","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/digitalcardboard.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/digitalcardboard.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/digitalcardboard.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/digitalcardboard.com\/blog\/wp-json\/wp\/v2\/comments?post=194"}],"version-history":[{"count":5,"href":"https:\/\/digitalcardboard.com\/blog\/wp-json\/wp\/v2\/posts\/194\/revisions"}],"predecessor-version":[{"id":218,"href":"https:\/\/digitalcardboard.com\/blog\/wp-json\/wp\/v2\/posts\/194\/revisions\/218"}],"wp:attachment":[{"href":"https:\/\/digitalcardboard.com\/blog\/wp-json\/wp\/v2\/media?parent=194"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/digitalcardboard.com\/blog\/wp-json\/wp\/v2\/categories?post=194"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/digitalcardboard.com\/blog\/wp-json\/wp\/v2\/tags?post=194"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}