Posted by admin on

Log Rotate and *NIX

This has changed since my days at Pyramid. There has been quite a lot of thinking and engineering about dealing with daemon logs. The places to look are via the syslogd, newsyslog project, you can see a the newsyslog man pages and using the keyword “rotate log”. The idea is that logs are rotated, although the names are not and that old logs are deleted. So the newest is called mypackage or mypackage.0 and the older logs increment the counter. Logs are generally kept in /var/log or /var/log/package_name and not in the package or product install tree. What a nob? There is a command ‘logrotate’; it can be installed using macports. It needs a a configuration file.

Daemons

Or Liunux/MacOS out of the box, I found these pages

Batch Programs

I have a problem today, I want to run a script periodically, on a laptop which will create a run log and I want to keep the logs tidy but each run is to have one log. I think I’ll write a function file since newlog is designed for daemons and I would need to manage the problem that my run needs to test the target log is empty before writing. I think I’ll refactor my functions to use logrotate. I now have the habit of placing the logs in /opt/local/log/appname and I place the conf files there too. It would be possible to place the conf files, if not job based in /etc and probably have a end of/start of day job rotate the logs.


Comments ( 3 )

  1. Dave
    I just amended the page to include direct reference to logrotate which I missed the first time round...idiot.
  2. Dave
    Time to look again; many features of Linux seem to use logrotate managed logs. have the habit of placing the logs in /opt/local/log/appname and I place the conf files there too. It would be possible to place the conf files, if not job based in /etc and probably have a end of/start of day job rotate the logs.
  3. Dave
    I need to check the links, they are a bit old and logrotate has obviously better

This site uses Akismet to reduce spam. Learn how your comment data is processed.

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close