Sync Gateway 1.2.0 log rotate issue

#1

Hi,

I have an issue with sync gateway log rotate and it was working fine before i upgrade to 1.2.0 from 1.1.1.

Here is the log rotate script.

/home/sync_gateway/logs/*.log {
daily
rotate 30
size 20M
delaycompress
compress
notifempty
missingok
postrotate
/usr/bin/pkill -HUP sync_gateway > /dev/null
endscript
}

I start Sync gateway service and it creates files fine as shown below.

[root@LTCouchDB4 logs]# initctl start sync_gateway
sync_gateway start/running, process 21636
[root@LTCouchDB4 logs]# ls -l
total 12
-rw-r–r-- 1 sync_gateway sync_gateway 0 Jun 29 12:49 sync_gateway_access.log
-rw-r–r-- 1 sync_gateway sync_gateway 9555 Jun 29 12:49 sync_gateway_error.log

When i run manually log rotate command it runs fine and renames the file but somehow sync gateway service still using renamed file instead of new file “sync_gateway_error.log”

[root@LTCouchDB4 logs]# /usr/sbin/logrotate -f /etc/logrotate.conf
[root@LTCouchDB4 logs]# ls -l
total 12
-rw-r–r-- 1 sync_gateway sync_gateway 0 Jun 29 12:49 sync_gateway_access.log
-rw-r–r-- 1 sync_gateway sync_gateway 0 Jun 29 12:49 sync_gateway_error.log
-rw-r–r-- 1 sync_gateway sync_gateway 9673 Jun 29 12:49 sync_gateway_error.log-20160629
[root@LTCouchDB4 logs]# /usr/sbin/logrotate -f /etc/logrotate.conf
[root@LTCouchDB4 logs]# ls -l
total 12
-rw-r–r-- 1 sync_gateway sync_gateway 0 Jun 29 12:49 sync_gateway_access.log
-rw-r–r-- 1 sync_gateway sync_gateway 0 Jun 29 12:49 sync_gateway_error.log
-rw-r–r-- 1 sync_gateway sync_gateway 9673 Jun 29 12:49 sync_gateway_error.log-20160629
[root@LTCouchDB4 logs]# /usr/sbin/logrotate -f /etc/logrotate.conf
[root@LTCouchDB4 logs]# ls -l
total 12
-rw-r–r-- 1 sync_gateway sync_gateway 0 Jun 29 12:49 sync_gateway_access.log
-rw-r–r-- 1 sync_gateway sync_gateway 0 Jun 29 12:49 sync_gateway_error.log
-rw-r–r-- 1 sync_gateway sync_gateway 9949 Jun 29 12:49 sync_gateway_error.log-20160629

You can see from above provided data sync gateway keeps writing logs to “sync_gateway_error.log-20160629” instead using a newly created log file “sync_gateway_error.log” .

Could you please help me to figure out this issue?

Thanks,
Karunakar Reddy

#2

I have manage to get it working by replacing “-HUP” with “SIGTERM” but not sure of any side effect so testing on test environment.