Home > Casper, Jamf Infrastructure Manager, Jamf Pro, Linux > Implementing log rotation for the Jamf Infrastructure Manager logs on Red Hat Enterprise Linux

Implementing log rotation for the Jamf Infrastructure Manager logs on Red Hat Enterprise Linux

A while back, I had set up the Jamf Infrastructure Manager (JIM) in a VM running Red Hat Enterprise Linux (RHEL) to provide a way for a Jamf Pro server hosted outside a company’s network to be able to talk to an otherwise inaccessible Active Directory domain. The JIM software has been running fine since I configured it, but I recently needed to take a look at the JIM logs as part of diagnosing another issue.

For those not familiar with the JIM software, it has several log files and those logs are available in the following location on RHEL:


Screen shot 2017 04 29 at 5 32 52 pm

When I checked the logs, I noticed that /var/log/jamf-im.log had grown to almost 500 MBs in size.

Considering this log is a plaintext file, that’s a big log file and it seemingly had been not been rotated or otherwise changed since I first installed the JIM software. To help make sure that the host VM would not eventually run out of space because of this growing log file, I needed to implement log rotation for the JIM logs. For more details, see below the jump.

Fortunately, RHEL includes logrotate, which is a utility that is designed to systematically rotate and archive log files. I just needed to add the following entries to the logrotate configuration file, located at /etc/logrotate.conf:

These entries would do the following:

  • missingok: If the log file is missing, logrotate will not output an error.
  • weekly: Run the log rotation process weekly on the specified log.
  • copytruncate: Make an archive copy of the original log file, then truncate the original log file to zero bytes in size. This allows the JIM to keep writing to the original log file without interruption.
  • create 700 jamfservice jamfservice: Create the archive copy of the logfile with the specified ownership permissions. In this case, the jamfservice account will have read and write permissions to the archive copy of the logfile while all other accounts will have no permissions.
  • dateext: Append the date to the archive copy of the logfile’s file name
  • rotate 4: Keep the last four archive copies of the logfile. Since logrotate is rotating the log on a weekly basis, this will mean roughly the last month’s worth of logs.
  • compress: Compress the archive copies of the logfile using gzip.

To configure the JIM log rotation settings, I’ve written the following script. It backs up the existing /etc/logrotate.conf configuration file then adds the entries for managing the JIM logs’ rotation:

  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: