Lucas Rolff
July 31, 2017 08:28AM
> I don't want to locate logs on ssd main (hardrive /var/log/nginx/) which is obviously smaller hard disk than my external sata hdd (/externalhdd/log/nginx/

Setup log rotation depending on size of logs or daily rotation.

> I still want my website to operate after restart because every week server restart by itself due to some limitation of some programs

Instead of randomly restarting – do a config check and only restart if the config is valid (should also validate the log location)

You write in your initial post that if the access log exists, then you should use the external harddrive, however – have you considered that the file might exist but the device is in read-only?

You could modify your init script or systemd start script to actually check for these things and generate a new nginx config depending on the result (hint: use place holders).

You could also symlink /externalhdd/log/nginx to /var/log/nginx – in this case if the drive is mounted it would use the external drive, if it’s not mounted the file would get written to your SSD – but still won’t make up for a read only device in case that happens.

To be honest, log rotation or symlinks would IMO be the best options.

On 31/07/2017, 13.08, "nginx on behalf of lifeisjustabout" <nginx-bounces@nginx.org on behalf of nginx-forum@forum.nginx.org> wrote:

Thanks for the response. The reason why I want to implement this is because
I have dedicated server and thanks to nginx everything is work perfectly so
I don't need to check server everyday. I don't want to locate logs on ssd
main (hardrive /var/log/nginx/) which is obviously smaller hard disk than my
external sata hdd (/externalhdd/log/nginx/). I am afraid if something
happens to external hard drive time to time, I still want my website to
operate after restart because every week server restart by itself due to
some limitation of some programs. I guess it will give me error message
nginx couldn't found access.log if external hard disk dies prior to restart
nginx. I want to avoid this problem.

thanks.

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,275761,275763#msg-275763

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx


_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

implementation of access.log with if condition

lifeisjustabout July 31, 2017 05:35AM

Re: implementation of access.log with if condition

Igor A. Ippolitov July 31, 2017 06:18AM

Re: implementation of access.log with if condition

lifeisjustabout July 31, 2017 07:08AM

Re: implementation of access.log with if condition

Lucas Rolff July 31, 2017 08:28AM

Re: implementation of access.log with if condition

lifeisjustabout July 31, 2017 10:33AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 109
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready