3

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
Chris S
  • 77,945
  • 11
  • 124
  • 216
Richard Knop
  • 1,149
  • 2
  • 20
  • 34
  • 2
    You might know this, but FreeBSD comes with a log archiver called [newsyslog](http://www.freebsd.org/doc/handbook/configtuning-configfiles.html#AEN16421). It's different then logrotate, but works pretty well. – Stefan Lasiewski Nov 15 '11 at 18:10
  • @Stefan Lasiewski Thanks. I made a new question. Could you take a look please? http://serverfault.com/questions/331543/newsyslog-wildcards-rotate-all-logs-in-a-directory – Richard Knop Nov 16 '11 at 13:49

1 Answers1

6

You installed a 32-bit Port on a 64-bit OS, or vice-versa.

Use pkg_delete to remove the old version. Try installing via pkg_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:

/var/log/httpd-access.log               644  5     *    $W6D0 JC /var/run/httpd.pid
/var/log/httpd-error.log                644  5     *    $W6D0 JC /var/run/httpd.pid

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:

/var/log/httpd-access.log               644  5     5000 *     JC /var/run/httpd.pid
/var/log/httpd-error.log                644  5     5000 *     JC /var/run/httpd.pid

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...

Chris S
  • 77,945
  • 11
  • 124
  • 216