Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I am able to rotate any log file manually via logroatate like this:

logrotate -f /etc/logrotate.d/my-hourly-file

I want to know how to perform the same action on FreeBSD 8?

My investigation shows that newsyslog can be used for this purpose. If so how can I download and install newsyslog?

Update: I think newsyslog has been installed and modifying the /etc/newsyslog.conf file will be enough for automatic installation. But how can I trigger it manually?

Update2: when I search all newsyslog words starting from /, I only found /etc/rc.d/newsyslog script. Inside the script I realized that newsyslog command is defined under /usr/sbin/newsyslog. But there is not newsyslog file under /usr/sbin/newsyslog.

I am stuck that how I can install newsyslog package into FreBSD 8

share|improve this question
add comment

1 Answer

It seems like you're new to FreeBSD, and coming from a Linux background.

Let's clear a few things up --

First, newsyslog isn't a package -- it's a program that comes with the base FreeBSD operating system. You shouldn't have to install it, and it should always be there.
If /usr/sbin/newsyslog is missing from your system someone has deleted it (for reasons I can't fathom) -- Find the previous sysadmin and find out what they did, and why.
(You may optionally want to beat them with a stick for removing core OS utilities.)

If you need to get newsyslog back in a hurry you can rebuild it from source, or copy it from another 8.x system. If you're in less of a hurry you can rebuild and install world which will also correct a number of other problems you may have on an inherited system (You should first make sure that this won't muck up any other measures you have in place for patching servers, and observe all the red boxes warning you to make backups).


Once you have newsyslog back you can force it to rotate log files one of two ways:

  • newsyslog -F will force ALL log files in newsyslog.conf to be rotated immediately.
  • newsyslog -R <files> will force the specified files to be rotated immediately.

Further information can be found in the newsyslog man page

share|improve this answer
    
You are right I am new to FreeBSD, but I am sure that /usr/sbin/newsyslog is missing and nobody has removed it. The installation of FreeBSD is alittle bit different than usual. I am using Pfsense which is installed with FreeBSD, it comes with FreeBSD. It may effect something else that causes newsyslog installation? Thanks. –  mmc18 Mar 26 '13 at 20:30
1  
Ahhh, pfSense is not FreeBSD (based on, certainly, but not the same). I've no idea what they're using for log rotation, but that said you can just grab a copy of newsyslog from a FreeBSD 8 box (install one in a VirtualBox VM if necessary). You may optionally want to beat the pfSense people with a stick and admonish them not to remove core OS utilities (or ask them where they moved it to) :) –  voretaq7 Mar 26 '13 at 23:57
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.