Search the Site

My Social
Meta
Powered by Squarespace
« Jamiroquai @ Ahoy Rotterdam | Main | Dissecting SRX RT_FLOW Logs with Splunk »
Monday
Mar282011

Adding Custom Logfile to OS X (Server) Log Rotation

The earlier posts on my logging experiences didn't include the log-rotation solution I used on my OS X Server.

When you create a new log file (and have syslog fill that file up), you're gonna run into a lack of space sooner or later. This happens because the syslog server keeps writing data to that file, and the system doesn't 'recognize' (read: isn't configured) the file for log-rotation. So, you need to tell the log-rotation process to include the new log file (and what to do with it).

In the latest version of OS X you can use the /etc/newsyslog.conf file to include your custom log file. This configuration file allows you to add (at least) the following parameters:

  • Count
    How many files are kept before they're deleted
  • Size in kB
    Maximum file size of the uncompressed raw logfile which triggers to rotate to a new log file (and compressing the old one).
  • When
    A time frame for compressing the log files. Entering 24 would rollover the log every 24-hours.

My entry for my SRX firewall logging has the following markup:

/var/log/srx.log                        640 10    10000 *     J

So, my log files rotates @10MB in size, and I keep 10 (compressed) old log files.

I restarted the server to apply the changes. Could be that restarting a (syslog??)service could also solve it, but my server had a reboot coming anyway.

Reader Comments (1)

Thanks for the tip. Just noticed you might be able to avoid editing the system newsyslog.conf by adding new files in /etc/newsyslog.d/

June 5, 2012 | Unregistered CommenterEd

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Post:
 
Some HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>