I am trying to get logrotate running on a FreeBSD 8.1 virtual machine. I installed the logrotate with pkg_add, I have created the logrotate.config file and also run:
mkdir /var/lib/
touch /var/lib/logrotate.status
Now when I do:
/usr/local/sbin/logrotate -d /usr/local/etc/logrotate.conf
I get this error:
ELF interpreter /libexec/ld-elf-so.1 not found
Abort
The file ld-elf-so.1 exists:
locate ld-elf.so.1
/libexec/ld-elf.so.1
/usr/libexec/ld-elf.so.1
/usr/share/man/man1/ld-elf.so.1.1.gz
You installed a 32-bit Port on a 64-bit OS, or vice-versa.
Use
pkg_delete
to remove the old version. Try installing viapkg_add -r logrotate
Also, as Stefan noted, FreeBSD comes with newsyslog, which is enabled by default (just edit
/etc/newsyslog.conf
to add log files as necessary), and does everything 99% of people need.Edit:
To configure newsyslog for Apache's standard logs add one of the following sets to the config file.
For weekly log rotations, keeping 5 weeks worth, and bzipping the old files:
The "$W6D0" tells it to rotate the logs first thing Sunday morning. For Daily, use
$D0
. For Monthly, use$M1D0
. The format is a touch backwards to read. For instance "$W6D0" means "Rotate of the week on the 6th day, of the day on the 0th hour" (the "D0" part is technically superfluous). This is specifying absolute times, you can also specify intervals instead. If you just put "1" in that field, it will rotate the log every 1 hour.To rotate the file when it hits 5MB:
The file size field is specified in KB. You can also specify both a time and a size in which case it will trigger a rotation when either conditions are met.
If you have any other specific needs just say so, like if Apache is jailed or chrooted, or you need another application, or you want the old log files in a different location...