{"id":482,"date":"2014-07-31T04:19:00","date_gmt":"2014-07-31T04:19:00","guid":{"rendered":"https:\/\/qbytes.cloud\/?p=482"},"modified":"2014-07-31T04:19:00","modified_gmt":"2014-07-31T04:19:00","slug":"zero-out-log-file","status":"publish","type":"post","link":"https:\/\/www.qbytes.cloud\/index.php\/2014\/07\/31\/zero-out-log-file\/","title":{"rendered":"Zero Out Log File"},"content":{"rendered":"<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n\n&gt; logfile\n\n<\/pre>\n<p>or<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n\ncat \/dev\/null &gt; logfile\n\n<\/pre>\n<p>if you want to be more eloquent, will empty logfile (actually they will truncate it to zero size).<\/p>\n<p>You can also use<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n\ntruncate logfile --size 0\n\n<\/pre>\n<p>to be perfectly explicit or, if you don&#8217;t want to,<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n\nrm logfile\n\n<\/pre>\n<p>(applications usually do recreate a logfile if it doesn&#8217;t exist already).<\/p>\n<p>However, since logfiles are usually useful, you might want to compress and save a copy. While you could do that with your own script, it is a good idea to at least try using an existing working solution, in this case logrotate, which can do exactly that and is reasonably configurable.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&gt; logfile or cat \/dev\/null &gt; logfile if you want to be more eloquent, will empty logfile (actually they will truncate it to zero size). You can also use truncate logfile &#8211;size 0 to be perfectly explicit or, if you don&#8217;t want to, rm logfile (applications usually do recreate a logfile if it doesn&#8217;t exist &#8230; <a title=\"Zero Out Log File\" class=\"read-more\" href=\"https:\/\/www.qbytes.cloud\/index.php\/2014\/07\/31\/zero-out-log-file\/\" aria-label=\"Read more about Zero Out Log File\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,59],"tags":[],"class_list":["post-482","post","type-post","status-publish","format-standard","hentry","category-administration","category-logs"],"_links":{"self":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts\/482","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/comments?post=482"}],"version-history":[{"count":0,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts\/482\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/media?parent=482"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/categories?post=482"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/tags?post=482"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}