Maxim Dounin
September 26, 2019 11:14AM
Hello!

On Thu, Sep 26, 2019 at 06:22:41AM -0400, krishna wrote:

> Dear Team,
>
> I have configured access_log and error_log at https block level and
> sometimes(like after log rotation), could see the logs are with 0 bytes
> (which means, nothing logged though it serves the requests and application
> is accessible).
>
> Any help would be appreciated to figure out the issue and why its occurring
> .
>
> Config:
>
> #Log file format
> log_format main '$remote_addr - $remote_user [$time_local] '
> '"$request" $status $body_bytes_sent '
> '"$http_referer" "$http_user_agent" "$gzip_ratio" ';
>
> access_log /var/logs/access.log main;
> error_log /var/logs/error.log error;
>
> Log Files:
>
> -rwxr-xr-x. 1 root root 0 Sep 25 03:13 access.log
> -rwxr-xr-x. 1 root root 0 Sep 26 03:34 error.log

These files are only writable by root, hence nginx worker
processes won't be able to open these for writing after log
rotation. You have to fix your log rotation configuration to
create files which are writable by nginx user.

For example, nginx own packages as available from nginx.org use
the following logrotate configuration
(http://hg.nginx.org/pkg-oss/file/tip/debian/nginx.logrotate):

/var/log/nginx/*.log {
daily
missingok
rotate 52
compress
delaycompress
notifempty
create 640 nginx adm
sharedscripts
postrotate
if [ -f /var/run/nginx.pid ]; then
kill -USR1 `cat /var/run/nginx.pid`
fi
endscript
}

Note the "create 640 nginx adm" line.

--
Maxim Dounin
http://mdounin.ru/
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Empty error and access log

krishna September 26, 2019 06:22AM

Re: Empty error and access log

krishna September 26, 2019 06:24AM

Re: Empty error and access log

Francis Daly September 26, 2019 07:10AM

Re: Empty error and access log

krishna September 26, 2019 07:25AM

Re: Empty error and access log

rick_pri September 26, 2019 09:13AM

Re: Empty error and access log

Francis Daly September 26, 2019 11:00AM

Re: Empty error and access log

Maxim Dounin September 26, 2019 11:10AM

Re: Empty error and access log

Maxim Dounin September 26, 2019 11:14AM

Re: Empty error and access log

krishna September 27, 2019 01:36AM

Re: Empty error and access log

Francis Daly September 27, 2019 01:58AM

Re: Empty error and access log

Francis Daly September 27, 2019 03:08AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 180
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready