Sync Gateway 1.3 stops logging after second rotate

We recently upgraded our development server to sync gateway v1.3 to try it out. We have logrotate setup with this configuration:

/home/sync_gateway/logs/sync_gateway_error.log {
        dateext
        dateformat -%s
        rotate 20
        size 10k
        missingok
        notifempty
        compress
        postrotate
                /usr/bin/pkill -HUP sync_gateway > /dev/null
        endscript
}

After the second rotation sync gateway stopped logging to the newly named sync_gateway_error.log and now it is not logging anything as far as I can tell. Is this a known error with sync gateway 1.3? Is there a workaround?

I’m not aware of any known issues with Sync Gateway 1.3. What OS are you running?

We’re running Ubuntu 12.04

What build of Sync Gateway were you upgrading from? (to help identify when a potential change to log rotation would have happened)

We upgraded from Sync Gateway 1.1.1 to 1.3. I didn’t realize that sync gateway 1.3 now comes with its own upstart script so after upgrading we temporarily had two upstart scripts, and when I ran sudo start sync_gateway it tried to start sync gateway twice. After I removed our old upstart script everything was running fine and the first log rotation in the new log location (/home/sync_gateway/logs) went fine, then when logrotate ran again a couple days later it stopped logging.

Any update on this issue? It’s a pretty big problem to have no logging for sync gateway in production.

@alexegli Apologies for the delay. I don’t think there’s anything that should have changed in SG 1.3 around log rotation.

Moved this to https://github.com/couchbase/sync_gateway/issues/2149 for further analysis.

I was missing the copytruncate option in my logrotate file. In the previous version we had (1.1.1) I think this caused an issue so we removed it, but in Sync Gateway 1.3.1 it is required to make the logrotation work properly.

1 Like