Apache Solr

Logrotate configuration file for Apache Solr on RHEL5

I'm running Solr using Jetty and logging to /var/log/solr.log.

This log is growing so I added a logrotate entry at /etc/logrotate.d/solr as follows:

# Logrotate file for /var/log/solr.log
/var/log/solr.log {
   rotate 5
   compress
   size 10M
   weekly
   postrotate
     /sbin/service solr restart
   endscript
}

Since this is a new file, the SELinux security context is off for /etc/logrotate.d/solr:

# ls -lZ /etc/logrotate.d
-rw-r--r--  root root system_u:object_r:etc_t          acpid
-rw-r--r--  root root system_u:object_r:etc_t          conman
-rw-r--r--  root root system_u:object_r:etc_t          cups
-rw-r--r--  root root system_u:object_r:etc_t          mgetty
-rw-r--r--  root root system_u:object_r:etc_t          ppp
-rw-r--r--  root root system_u:object_r:etc_t          psacct
-rw-r--r--  root root system_u:object_r:etc_t          rpm
-rw-r--r--  root root system_u:object_r:etc_t          setroubleshoot
-rw-r--r--  root root root:object_r:etc_t              solr
...

That can be fixed by telling SELinux to relabel the solr file using the correct context for /etc/logrotate.d/:

# chcon --reference=/etc/logrotate.d solr
[root@plpt300 logrotate.d]# ls -lZ
-rw-r--r--  root root system_u:object_r:etc_t          acpid
-rw-r--r--  root root system_u:object_r:etc_t          conman
-rw-r--r--  root root system_u:object_r:etc_t          cups
-rw-r--r--  root root system_u:object_r:etc_t          mgetty
-rw-r--r--  root root system_u:object_r:etc_t          ppp
-rw-r--r--  root root system_u:object_r:etc_t          psacct
-rw-r--r--  root root system_u:object_r:etc_t          rpm
-rw-r--r--  root root system_u:object_r:etc_t          setroubleshoot
-rw-r--r--  root root system_u:object_r:etc_t          solr
...

The new config file can be checked using the debug flag for logrotate, e.g.:

# logrotate --debug /etc/logrotate.d/solr
reading config file /etc/logrotate.d/solr
reading config info for /var/log/solr.log

Handling 1 logs

rotating pattern: /var/log/solr.log  weekly (5 rotations)
empty log files are rotated, old logs are removed
considering log /var/log/solr.log
  log does not need rotating
not running postrotate script, since no logs were rotated

Solr Multicore with Drupal Apachesolr Module

Sometimes a picture is worth a thousand words. Here's Apache Solr in a multicore setup with two cores, one named hhpn and one named picdinfo. I thought this setup was nice because it allows one site to use the schema from the apachesolr 6.x-1.2 release and one site to use the schema from the 6.x-2.x-dev branch.

References:

http://drupal.org/node/484800
http://janaksingh.com/blog/apachesolr-search-drupal-centos-107

Subscribe to RSS - Apache Solr