Welcome! Log In Create A New Profile

Advanced

Re: Feature Request for access_log stdout;

Aleksandar Lazic
February 17, 2016 02:06PM
Hi.

Am 17-02-2016 16:47, schrieb Valentin V. Bartenev:
> On Wednesday 17 February 2016 16:26:01 Aleksandar Lazic wrote:
>> Hi.
>>
>> how difficult is it to be able to add "access_log stdout;" to nginx,
>> similar like "error_log stderr;"?
>>
>> I ask because in some PaaS environment is it difficult to setup a
>> dedicated user yust for nginx.
>>
>> It fits also a little bit better to http://12factor.net/logs
>>
> [..]
>
> What's the problem with "access_log /dev/stdout"?

Well I have the following problem on openshift v3.

#######
nginx: [alert] could not open error log file: open()
"/var/log/nginx/error.log" failed (13: Permission denied)
2016/02/17 18:34:32 [warn] 1#1: the "user" directive makes sense only if
the master process runs with super-user privileges, ignored in
/etc/nginx/nginx.conf:2
2016/02/17 18:34:32 [emerg] 1#1: open() "/dev/stdout" failed (13:
Permission denied)

I have no name!@nginx-test-8-emwut:/$
I have no name!@nginx-test-8-emwut:/$ ls -la /dev/stdout
lrwxrwxrwx. 1 root root 15 Feb 17 18:24 /dev/stdout -> /proc/self/fd/1
I have no name!@nginx-test-8-emwut:/$ id
uid=1000550000 gid=0(root) groups=0(root)
#######

The config file is this
######
user nginx;
worker_processes 1;

error_log stderr warn;
pid /tmp/nginx.pid;


events {
worker_connections 1024;
}


http {
include /etc/nginx/mime.types;
default_type application/octet-stream;

log_format main '$remote_addr - $remote_user [$time_local]
"$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';

access_log /dev/stdout;

sendfile on;
#tcp_nopush on;

keepalive_timeout 65;

#gzip on;

include /etc/nginx/conf.d/*.conf;
}
##########

The difficulty is that the build and run setup differs in that case that
you are root at build time but any arbitrary user at runtime.

Here some more details.

https://docs.openshift.com/enterprise/3.1/creating_images/guidelines.html#use-uid

In case you have a openshift running you can use this repo for testing.

https://github.com/git001/nginx-osev3


> Please note that writing logs to stdout can be a bottleneck, or cause
> nginx
> to stuck. The "error_log stderr;" exists mostly for development
> purposes.

Thanks for tip.
I remember that 'daemon off' have the same background ;-)

br Aleks

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

Feature Request for access_log stdout;

Aleksandar Lazic February 17, 2016 10:28AM

Re: Feature Request for access_log stdout;

Valentin V. Bartenev February 17, 2016 10:48AM

Re: Feature Request for access_log stdout;

Aleksandar Lazic February 17, 2016 02:06PM

Re: Feature Request for access_log stdout;

Andrew Hutchings February 18, 2016 04:46AM

Re: Feature Request for access_log stdout;

Andrew Hutchings February 18, 2016 04:56AM

Re: Feature Request for access_log stdout;

Aleksandar Lazic February 18, 2016 09:04AM

Re: Feature Request for access_log stdout;

Aleksandar Lazic February 18, 2016 06:58PM

Re: Feature Request for access_log stdout;

Konstantin Pavlov February 19, 2016 03:44AM

Re: Feature Request for access_log stdout;

Aleksandar Lazic February 21, 2016 02:08AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 149
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