How to implement Log File Rotation in Linux Servers

NB: We are using CentOS Servers
  1. Switch to root user
  2. cd /etc/logrotate.d/  (by default we will be having this directory in our server)
  3. create a new file project-logs   vi project-logs
  4. Add the following piece of code to this file
            /folder-path-of-your-log/*.log {
               size=10M
               missingok
               rotate 20
               compress
               delaycompress
               notifempty
               copytruncate
              daily
          }

     5.  logrotate -f /etc/logrotate.d/

      
This will create new log files once the log file size reaches 10MB.

Comments

  1. Great information shared about ROR, its really helps in Rails development. Thanks a lot for sharing.

    ReplyDelete
  2. Here is a good case study on how evolveum developed elaborate log viewer showing basic performance information, displaying customized lists of relevant lines, selecting lines to be displayed in the outline e. g. to see only relevant threads, (collapsing, expanding) of structured information at the level of log entries https://evolveum.com/blog/problem-analysis-evolveum-log-viewer/ worth reading.

    ReplyDelete
  3. Thanks for sharing. If you are looking for Ruby on Rails companies in India, then contact Cryptex Technologies. It is one of the most well-known company who works on ROR from last 8 years. So if you wwant to develop any application on ROR or have any queries email us at: info@cryptextechnologies.com

    ReplyDelete

Post a Comment

Popular posts from this blog

How to SSH to remote server without entering password each time.

How to redirect a URL in NGINX

Ruby on Rails Installation on Windows 7