{"id":2685,"date":"2020-12-14T06:09:04","date_gmt":"2020-12-14T06:09:04","guid":{"rendered":"https:\/\/ubiq.co\/tech-blog\/?p=2685"},"modified":"2024-06-13T09:20:00","modified_gmt":"2024-06-13T09:20:00","slug":"how-to-configure-nginx-log-rotation","status":"publish","type":"post","link":"https:\/\/ubiq.co\/tech-blog\/how-to-configure-nginx-log-rotation\/","title":{"rendered":"How To Configure NGINX Log Rotation"},"content":{"rendered":"\n<p>NGINX is a popular web server used to host many high traffic websites and applications. It is a favorite for administrators. Log management is an important task for every website administrator. When we run NGINX web server its log files can get very large over time. This can make things difficult for administrators. Luckily, NGINX allows you to rotate log files so that you can automatically create new log files and archive old ones. In this article, we will look at how to configure NGINX log rotation.<\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-configure-nginx-log-rotation\/#What_is_Log_Rotation\" >What is Log Rotation?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-configure-nginx-log-rotation\/#How_To_Configure_NGINX_Log_Rotation\" >How To Configure NGINX Log Rotation<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-configure-nginx-log-rotation\/#1_Install_logrotate\" >1. Install logrotate<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-configure-nginx-log-rotation\/#2_Configure_Log_rotation_in_NGINX\" >2. Configure Log rotation in NGINX<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-configure-nginx-log-rotation\/#3_Manage_logrotate\" >3. Manage logrotate<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-configure-nginx-log-rotation\/#Conclusion\" >Conclusion<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_is_Log_Rotation\"><\/span>What is Log Rotation?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>When you run a web server, its log files grow over time and eventually become very large to manage. As a result, you may run out of server disk space. This can affect application performance and increase storage costs. In fact, it will also affect performance of other applications running on the server since they will all compete for disk space. A common solution to this problem is Log rotation, whereby you archive a log file when it exceeds a specific size threshold, and replace it with a new file. There are many third party log rotation programs that help you do this. Log rotation allows you to automatically create new empty log files, archive current log file, and delete old archives conditionally. It simplifies life for website administrators who need to manage log files for debugging purposes.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"How_To_Configure_NGINX_Log_Rotation\"><\/span>How To Configure NGINX Log Rotation<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>There are many third party utilities to do log rotation. We will basically install logrotate command in Ubuntu and then point it to the log files of NGINX. Here are the steps to configure NGINX log rotation.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"1_Install_logrotate\"><\/span>1. Install logrotate <span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p><em><a href=\"https:\/\/github.com\/logrotate\/logrotate\" target=\"_blank\" rel=\"noreferrer noopener\">Logrotate<\/a><\/em> utility allows you to automate the process of log rotation. It allows you to control the number &amp; size of log files for various processes running on your server by automatically compressing, archiving &amp; deleting old log files. <\/p>\n\n\n\n<p>Open terminal and run the following command to install it.<\/p>\n\n\n\n<p><strong>Ubuntu\/Debian<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ sudo apt-get install logrotate <\/pre>\n\n\n\n<p><strong>CentOS\/Redhat\/Fedora<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">#yum install logrotate -y<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"2_Configure_Log_rotation_in_NGINX\"><\/span>2. Configure Log rotation in NGINX<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p><em>Logrotate<\/em> is pre-configured to work with popular web servers like NGINX\/Apache. It consists of 2 configuration files. Logrotate&#8217;s global config file is located at <em>\/etc\/logrotate.conf<\/em> contains all main settings of logrotate program. It can be overridden, by placing app-specific or website-specific config files at <em>\/etc\/logrotate.d\/<\/em>.<\/p>\n\n\n\n<p>The default config file for NGINX server is located at <em>\/etc\/logrotate.d\/nginx<\/em> or <em>\/etc\/logrotate.d\/nginx-rc<\/em> which can be used as a template for adding more websites\/apps. This configuration basically consists of paths to log file directories along with keyword-based directives placed within {&#8230;}. It describes log file location, frequency of rotation, number of copies to be retained, and actions before\/after deletion.<\/p>\n\n\n\n<p>If you open it, this is what it looks like.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\/var\/log\/nginx\/*.log {\n        weekly\n        missingok\n        rotate 52\n        compress\n        delaycompress\n        notifempty\n        create 0640 www-data adm\n        sharedscripts\n        prerotate\n                if [ -d \/etc\/logrotate.d\/httpd-prerotate ]; then \\\n                        run-parts \/etc\/logrotate.d\/httpd-prerotate; \\\n                fi \\\n        endscript\n        postrotate\n                invoke-rc.d nginx rotate &gt;\/dev\/null 2&gt;&amp;1\n        endscript\n}\n<\/pre>\n\n\n\n<p>Let us look at it in detail.<\/p>\n\n\n\n<p><strong>weekly<\/strong> &#8211; rotate logs once a week<\/p>\n\n\n\n<p><strong>missingok<\/strong> &#8211; do not throw error if log file is missing<\/p>\n\n\n\n<p><strong>rotate 52<\/strong> &#8211; keep 52 log files, one for each week of the year. It will delete old files only after keeping on year worth of log files. You can change this to <em>rotate 4<\/em> to keep 4 weeks worth of log files instead.<\/p>\n\n\n\n<p><strong>compress<\/strong> &#8211; compress old log files to save space<\/p>\n\n\n\n<p><strong>notifempty<\/strong> &#8211; ensure that logrotate only writes to new files<\/p>\n\n\n\n<p><strong>create<\/strong> &#8211; create new empty log file after each rotation<\/p>\n\n\n\n<p><strong>sharedscripts<\/strong> &#8211; logrotate will run only once, no matter how many log files no matter how many log files match its pattern<\/p>\n\n\n\n<p><strong>postrotate\/prerotate<\/strong> &#8211; postrotate script is run after log rotation. prerotate script is run before log rotation.<\/p>\n\n\n\n<p>If you have used default installation the logrotate should be able to easily pick up the NGINX log files from their default location. <\/p>\n\n\n\n<p>To make logrotate rotate logs of other applications, place separate log files in \/etc\/lograte.d or add more log file paths in the same file, for other applications. As mentioned earlier, each config file is nothing but a collection of log file paths with keyword-based instructions enclosed within {&#8230;}.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"3_Manage_logrotate\"><\/span>3. Manage logrotate<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Logrotate will automatically run on your server, once installed. You don&#8217;t need to start the service on boot or set up cron jobs for it.<\/p>\n\n\n\n<p>All you need to do is place config files for each app at <em>\/etc\/logrotate.d\/<\/em> and logrotate will automatically take care of its log files for you.<\/p>\n\n\n\n<p>You can also run logrotate manually with the following command.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">logrotate [options] config_file_location<\/pre>\n\n\n\n<p>Here is an example to run logrotate with the config file at \/etc\/logrotate.d.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">logrotate \/etc\/logrotate.d<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Conclusion\"><\/span>Conclusion<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>It is very important to carefully manage log files on your web servers so that they do not get out of control and take up a lot of disk space. Software development teams often need to look into old logs for troubleshooting and debugging purposes. So it is essential to properly archive old logs. Logrotate is a great software that allows you to easily automate log rotation. It works not only with web server but with any process that generates log files. You just need to include its path in lograte config file, and it will take care of the rest.<\/p>\n\n\n\n<p><a href=\"http:\/\/ubiq.co\/\">Ubiq<\/a>\u00a0makes it easy to visualize data in minutes, and monitor in real-time dashboards.\u00a0<a href=\"http:\/\/ubiq.co\/accounts\/register\">Try it<\/a> today!<\/p>\n\n\n\n<p>Also read : <br><a href=\"https:\/\/ubiq.co\/tech-blog\/how-to-fix-nginx-worker-connections-are-not-enough\/\">How to Fix NGINX Worker Connections not enough<\/a><br><a href=\"https:\/\/ubiq.co\/tech-blog\/how-to-disable-etag-in-nginx\/\">How to Disable ETag in NGINX<\/a><br><a href=\"https:\/\/ubiq.co\/tech-blog\/how-to-fix-414-request-uri-too-large-in-apache\/\">How to Fix URI Request Too Large Error in Apache<\/a><br><a href=\"https:\/\/ubiq.co\/tech-blog\/apache-restrict-access-to-url-by-ip\/\">Apache Restrict Access to URL By IP<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>NGINX log rotation allows you to rotate logs without piling up. Here is how to configure NGINX log rotation.<\/p>\n","protected":false},"author":1,"featured_media":2696,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[9],"tags":[261],"class_list":["post-2685","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-nginx","tag-log-rotation"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.2 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How To Configure NGINX Log Rotation - Ubiq BI<\/title>\n<meta name=\"description\" content=\"NGINX log rotation allows you to rotate logs without piling up. Here is how to configure NGINX log rotation.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-configure-nginx-log-rotation\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How To Configure NGINX Log Rotation - Ubiq BI\" \/>\n<meta property=\"og:description\" content=\"NGINX log rotation allows you to rotate logs without piling up. Here is how to configure NGINX log rotation.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/ubiq.co\/tech-blog\/how-to-configure-nginx-log-rotation\/\" \/>\n<meta property=\"og:site_name\" content=\"Ubiq BI\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/ubiqbi\" \/>\n<meta property=\"article:published_time\" content=\"2020-12-14T06:09:04+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-06-13T09:20:00+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/ubiq.co\/tech-blog\/wp-content\/uploads\/2020\/12\/configure-log-rotation-in-nginx.png\" \/>\n\t<meta property=\"og:image:width\" content=\"600\" \/>\n\t<meta property=\"og:image:height\" content=\"300\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Sreeram Sreenivasan\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@UbiqBI\" \/>\n<meta name=\"twitter:site\" content=\"@UbiqBI\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Sreeram Sreenivasan\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/ubiq.co\/tech-blog\/how-to-configure-nginx-log-rotation\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/ubiq.co\/tech-blog\/how-to-configure-nginx-log-rotation\/\"},\"author\":{\"name\":\"Sreeram Sreenivasan\",\"@id\":\"https:\/\/ubiq.co\/tech-blog\/#\/schema\/person\/db98d49a766a3a111d8510935ab90abc\"},\"headline\":\"How To Configure NGINX Log Rotation\",\"datePublished\":\"2020-12-14T06:09:04+00:00\",\"dateModified\":\"2024-06-13T09:20:00+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/ubiq.co\/tech-blog\/how-to-configure-nginx-log-rotation\/\"},\"wordCount\":901,\"image\":{\"@id\":\"https:\/\/ubiq.co\/tech-blog\/how-to-configure-nginx-log-rotation\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2020\/12\/configure-log-rotation-in-nginx.png?fit=600%2C300&ssl=1\",\"keywords\":[\"log rotation\"],\"articleSection\":[\"Nginx\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/ubiq.co\/tech-blog\/how-to-configure-nginx-log-rotation\/\",\"url\":\"https:\/\/ubiq.co\/tech-blog\/how-to-configure-nginx-log-rotation\/\",\"name\":\"How To Configure NGINX Log Rotation - Ubiq BI\",\"isPartOf\":{\"@id\":\"https:\/\/ubiq.co\/tech-blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/ubiq.co\/tech-blog\/how-to-configure-nginx-log-rotation\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/ubiq.co\/tech-blog\/how-to-configure-nginx-log-rotation\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2020\/12\/configure-log-rotation-in-nginx.png?fit=600%2C300&ssl=1\",\"datePublished\":\"2020-12-14T06:09:04+00:00\",\"dateModified\":\"2024-06-13T09:20:00+00:00\",\"author\":{\"@id\":\"https:\/\/ubiq.co\/tech-blog\/#\/schema\/person\/db98d49a766a3a111d8510935ab90abc\"},\"description\":\"NGINX log rotation allows you to rotate logs without piling up. Here is how to configure NGINX log rotation.\",\"breadcrumb\":{\"@id\":\"https:\/\/ubiq.co\/tech-blog\/how-to-configure-nginx-log-rotation\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/ubiq.co\/tech-blog\/how-to-configure-nginx-log-rotation\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/ubiq.co\/tech-blog\/how-to-configure-nginx-log-rotation\/#primaryimage\",\"url\":\"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2020\/12\/configure-log-rotation-in-nginx.png?fit=600%2C300&ssl=1\",\"contentUrl\":\"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2020\/12\/configure-log-rotation-in-nginx.png?fit=600%2C300&ssl=1\",\"width\":600,\"height\":300,\"caption\":\"configure log rotation in nginx\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/ubiq.co\/tech-blog\/how-to-configure-nginx-log-rotation\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/ubiq.co\/tech-blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How To Configure NGINX Log Rotation\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/ubiq.co\/tech-blog\/#website\",\"url\":\"https:\/\/ubiq.co\/tech-blog\/\",\"name\":\"Ubiq BI\",\"description\":\"Build dashboards &amp; reports in minutes\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/ubiq.co\/tech-blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/ubiq.co\/tech-blog\/#\/schema\/person\/db98d49a766a3a111d8510935ab90abc\",\"name\":\"Sreeram Sreenivasan\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/secure.gravatar.com\/avatar\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g\",\"caption\":\"Sreeram Sreenivasan\"},\"description\":\"Sreeram Sreenivasan is the Founder of Ubiq. He has helped many Fortune 500 companies in the areas of BI &amp; software development.\",\"sameAs\":[\"https:\/\/www.linkedin.com\/in\/sreeram-sreenivasan\/\"],\"url\":\"https:\/\/ubiq.co\/tech-blog\/author\/wordpress\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How To Configure NGINX Log Rotation - Ubiq BI","description":"NGINX log rotation allows you to rotate logs without piling up. Here is how to configure NGINX log rotation.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/ubiq.co\/tech-blog\/how-to-configure-nginx-log-rotation\/","og_locale":"en_US","og_type":"article","og_title":"How To Configure NGINX Log Rotation - Ubiq BI","og_description":"NGINX log rotation allows you to rotate logs without piling up. Here is how to configure NGINX log rotation.","og_url":"https:\/\/ubiq.co\/tech-blog\/how-to-configure-nginx-log-rotation\/","og_site_name":"Ubiq BI","article_publisher":"https:\/\/www.facebook.com\/ubiqbi","article_published_time":"2020-12-14T06:09:04+00:00","article_modified_time":"2024-06-13T09:20:00+00:00","og_image":[{"width":600,"height":300,"url":"https:\/\/ubiq.co\/tech-blog\/wp-content\/uploads\/2020\/12\/configure-log-rotation-in-nginx.png","type":"image\/png"}],"author":"Sreeram Sreenivasan","twitter_card":"summary_large_image","twitter_creator":"@UbiqBI","twitter_site":"@UbiqBI","twitter_misc":{"Written by":"Sreeram Sreenivasan","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/ubiq.co\/tech-blog\/how-to-configure-nginx-log-rotation\/#article","isPartOf":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-configure-nginx-log-rotation\/"},"author":{"name":"Sreeram Sreenivasan","@id":"https:\/\/ubiq.co\/tech-blog\/#\/schema\/person\/db98d49a766a3a111d8510935ab90abc"},"headline":"How To Configure NGINX Log Rotation","datePublished":"2020-12-14T06:09:04+00:00","dateModified":"2024-06-13T09:20:00+00:00","mainEntityOfPage":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-configure-nginx-log-rotation\/"},"wordCount":901,"image":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-configure-nginx-log-rotation\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2020\/12\/configure-log-rotation-in-nginx.png?fit=600%2C300&ssl=1","keywords":["log rotation"],"articleSection":["Nginx"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/ubiq.co\/tech-blog\/how-to-configure-nginx-log-rotation\/","url":"https:\/\/ubiq.co\/tech-blog\/how-to-configure-nginx-log-rotation\/","name":"How To Configure NGINX Log Rotation - Ubiq BI","isPartOf":{"@id":"https:\/\/ubiq.co\/tech-blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-configure-nginx-log-rotation\/#primaryimage"},"image":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-configure-nginx-log-rotation\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2020\/12\/configure-log-rotation-in-nginx.png?fit=600%2C300&ssl=1","datePublished":"2020-12-14T06:09:04+00:00","dateModified":"2024-06-13T09:20:00+00:00","author":{"@id":"https:\/\/ubiq.co\/tech-blog\/#\/schema\/person\/db98d49a766a3a111d8510935ab90abc"},"description":"NGINX log rotation allows you to rotate logs without piling up. Here is how to configure NGINX log rotation.","breadcrumb":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-configure-nginx-log-rotation\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/ubiq.co\/tech-blog\/how-to-configure-nginx-log-rotation\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/ubiq.co\/tech-blog\/how-to-configure-nginx-log-rotation\/#primaryimage","url":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2020\/12\/configure-log-rotation-in-nginx.png?fit=600%2C300&ssl=1","contentUrl":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2020\/12\/configure-log-rotation-in-nginx.png?fit=600%2C300&ssl=1","width":600,"height":300,"caption":"configure log rotation in nginx"},{"@type":"BreadcrumbList","@id":"https:\/\/ubiq.co\/tech-blog\/how-to-configure-nginx-log-rotation\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/ubiq.co\/tech-blog\/"},{"@type":"ListItem","position":2,"name":"How To Configure NGINX Log Rotation"}]},{"@type":"WebSite","@id":"https:\/\/ubiq.co\/tech-blog\/#website","url":"https:\/\/ubiq.co\/tech-blog\/","name":"Ubiq BI","description":"Build dashboards &amp; reports in minutes","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/ubiq.co\/tech-blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/ubiq.co\/tech-blog\/#\/schema\/person\/db98d49a766a3a111d8510935ab90abc","name":"Sreeram Sreenivasan","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g","caption":"Sreeram Sreenivasan"},"description":"Sreeram Sreenivasan is the Founder of Ubiq. He has helped many Fortune 500 companies in the areas of BI &amp; software development.","sameAs":["https:\/\/www.linkedin.com\/in\/sreeram-sreenivasan\/"],"url":"https:\/\/ubiq.co\/tech-blog\/author\/wordpress\/"}]}},"jetpack_featured_media_url":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2020\/12\/configure-log-rotation-in-nginx.png?fit=600%2C300&ssl=1","jetpack_shortlink":"https:\/\/wp.me\/pbGGTT-Hj","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/posts\/2685","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/comments?post=2685"}],"version-history":[{"count":21,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/posts\/2685\/revisions"}],"predecessor-version":[{"id":3386,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/posts\/2685\/revisions\/3386"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/media\/2696"}],"wp:attachment":[{"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/media?parent=2685"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/categories?post=2685"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/tags?post=2685"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}