Tech Tips

  1. Uncategorized
  2. 366 view

[Nginx][Cronolog]Simple Log rotation

Contents

Overview

Set log rotation with Cronolog.

Environment

  • OS
    • Linux www4322gi 3.2.0-64-generic #97-Ubuntu SMP Wed Jun 4 22:04:21 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

Work flow

1.Check log setting of Nginx

If you change the setting, do not forget to restart.
sudo vim /etc/nginx/sites-available/main
-----
access_log /home/www/logs/access.log;
error_log /home/www/logs/error.log;
-----
sudo /etc/init.d/nginx restart

2.Install Cronolog

sudo apt-get install cronolog

3. Remake log files

rm /home/www/logs/access.log
rm /home/www/logs/error.log
mkfifo /home/www/logs/access.log
mkfifo /home/www/logs/error.log

4. Setting of Cronolog

tail -f /home/www/logs/access.log | /usr/bin/cronolog /home/www/logs/access.%Y-%m-%d.log
tail -f /home/www/logs/error.log | /usr/bin/cronolog /home/www/logs/error.%Y-%m-%d.log

Reference

Uncategorized recent post

  1. Run Amazon FreeRTOS on M5Stack Core2 for AWS …

  2. Udacity Self-Driving Car Engineer Nanodegree …

  3. Install sbt 1.0.0 and run sample template

  4. Visualization of Neural Network and its Train…

  5. [Machine Learning]Created docker image includ…

関連記事

PAGE TOP