I am not able to figure out how to perform logrotate. Where should the spinx-logrotate file need to reside? What exact linux command need to be issued? I tried
sphinx --rotate main
but that doesn't work.

Otherwise, the sphinxsearch is working great for my site. You can even use my site (www.pico-car.com) as demo site for the search.

Comments

VinayKAgarwal’s picture

Actually I just realized that these are two separate questions
1. how to rotate index
2. how to rotate log
I need help with both. :-)

VinayKAgarwal’s picture

It seems the script (to index) already has --rotate option in it - is there anything else needed to be done?

markus_petrux’s picture

1. how to rotate index

--rotate is an optional argument for the Sphinx indexer command. It is necessary if indexer command is executed when the searchd daemon is running.

The provided script docs/contrib/sphinx contains examples on how to do this.

2. how to rotate log

The file docs/contrib/sphinx-logrotate is just an example. It needs to be adjusted for your particular configuration. Here's the contents of the sample provided:

/usr/local/sphinx/var/log/*.log {
  daily
  rotate 7
  create 640 root root
  postrotate
    /path-to-your-script/sphinx restart
  endscript
}

You may change all logrotate options or leave them as-is, except the path to your sphinx start/stop script.

Once this is done, you should adjust the logrotate configuration in your system so this snippet can be executed.

If directory /etc/logrotate.d exists, then just copy your adjusted version of the file docs/contrib/sphinx-logrotate.

If directory /etc/logrotate.d does not exist, then try to find the file /etc/logrotate.conf.

I'm not sure if logrotate is configured the same way in all linux distros out there, so you may try "man logrotate" from your linux console if the above indications don't apply in your linux box.

VinayKAgarwal’s picture

Thanks - this clarified everything :-)

markus_petrux’s picture

Thanks - this clarified everything :-)

You're welcome. :-)

Otherwise, the sphinxsearch is working great for my site. You can even use my site (www.pico-car.com) as demo site for the search.

Sweet. I would appreciate if you could open a separate issue describing how you're using Sphinx search, number of nodes, time your indexer processes take to rebuild indexes, or something of that sort. Not too much info, just a little, so other users might find something useful there. I would then link to your site and to that issue from the project page. :-)

markus_petrux’s picture

Status: Active » Fixed
markus_petrux’s picture

Status: Fixed » Closed (fixed)
Kai’s picture

I suggest to also add

sharedscripts

otherwise sphinx get restarted for each *.log file found in /usr/local/sphinx/var/log/


Anyway may be this one is a better way to rotate the logs since sphinx doesn't need to be restarted.

/var/log/sphinx/*.log {
        daily
        missingok
        rotate 7
        compress
        delaycompress
        notifempty
        copytruncate   
}