# Feature Request for access\_log stdout;

**URL:** <https://www.ruby-forum.com/t/feature-request-for-access-log-stdout/244080>\
**Category:** NGINX\
**Created:** [February 17, 2016, 4:26pm UTC](https://www.ruby-forum.com/t/feature-request-for-access-log-stdout/244080 "2016-02-17T16:26:30Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sadaf\_N](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/858c86/32.png) [@Sadaf\_N](https://www.ruby-forum.com/u/Sadaf_N)\
**Post date:** [February 17, 2016, 4:26pm UTC](https://www.ruby-forum.com/t/feature-request-for-access-log-stdout/244080/1 "2016-02-17T16:26:30Z")

</div>

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](http://12factor.net/logs)

BR Aleks

---

<div class="post-metadata">

**Author:** ![Aleksandar\_L](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/8edcca/32.png) [@Aleksandar\_L](https://www.ruby-forum.com/u/Aleksandar_L)\
**Post date:** [February 17, 2016, 4:48pm UTC](https://www.ruby-forum.com/t/feature-request-for-access-log-stdout/244080/2 "2016-02-17T16:48:07Z")

</div>

On Wednesday 17 February 2016 16:26:01 Aleksandar L. 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 [The Twelve-Factor App](http://12factor.net/logs)

[..]

What’s the problem with “access\_log /dev/stdout”?

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.

wbr, Valentin V. Bartenev

---

<div class="post-metadata">

**Author:** ![Aleksandar\_L](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/8edcca/32.png) [@Aleksandar\_L](https://www.ruby-forum.com/u/Aleksandar_L)\
**Post date:** [February 18, 2016, 9:59am UTC](https://www.ruby-forum.com/t/feature-request-for-access-log-stdout/244080/3 "2016-02-18T09:59:46Z")

</div>

Hi Aleksandar,

On 17/02/16 19:04, Aleksandar L. wrote:

> > > dedicated user yust for nginx.  
> > > nginx: [alert] could not open error log file: open()  
> > > I have no name!@nginx-test-8-emwut:/$ id  
> > > uid=1000550000 gid=0(root) groups=0(root)  
> > > #######

What version of Docker are you running? If it is prior to 1.9 you are  
likely to hit his bug: [Permission denied on /dev/stderr · Issue #6880 · moby/moby · GitHub](https://github.com/docker/docker/issues/6880)

## Kind Regards

Andrew H. (LinuxJedi)  
Technical Product Manager, NGINX Inc.

---

<div class="post-metadata">

**Author:** ![Aleksandar\_L](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/8edcca/32.png) [@Aleksandar\_L](https://www.ruby-forum.com/u/Aleksandar_L)\
**Post date:** [February 17, 2016, 8:04pm UTC](https://www.ruby-forum.com/t/feature-request-for-access-log-stdout/244080/4 "2016-02-17T20:04:58Z")

</div>

Hi.

Am 17-02-2016 16:47, schrieb Valentin V. Bartenev:

> > 
> 
> [..]
> 
> 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](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.

> **[GitHub - git001/nginx-osev3](https://github.com/git001/nginx-osev3)**
>
> Contribute to git001/nginx-osev3 development by creating an account on GitHub.

> 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

---

<div class="post-metadata">

**Author:** ![Aleksandar\_L](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/8edcca/32.png) [@Aleksandar\_L](https://www.ruby-forum.com/u/Aleksandar_L)\
**Post date:** [February 18, 2016, 10:17am UTC](https://www.ruby-forum.com/t/feature-request-for-access-log-stdout/244080/5 "2016-02-18T10:17:18Z")

</div>

On 18/02/16 08:59, Andrew H. wrote:

> > > > similar like “error\_log stderr;”?  
> > > > Well I have the following problem on openshift v3.  
> > > > 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)  
> > > > #######
> 
> What version of Docker are you running? If it is prior to 1.9 you are  
> likely to hit his bug: [Permission denied on /dev/stderr · Issue #6880 · moby/moby · GitHub](https://github.com/docker/docker/issues/6880)

Also, as Valentin mentioned. Performance of any application, not just  
NGINX, that logs a lot of data is going to be terrible when you actually  
manage to do this.

There are many flaws in the The Factor-Factor App document and whilst it  
may work out for you backend services I wouldn’t recommend following it  
too closely for any core infrastructure.

## Kind Regards

Andrew H. (LinuxJedi)  
Technical Product Manager, NGINX Inc.

---

<div class="post-metadata">

**Author:** ![Aleksandar\_L](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/8edcca/32.png) [@Aleksandar\_L](https://www.ruby-forum.com/u/Aleksandar_L)\
**Post date:** [February 18, 2016, 3:03pm UTC](https://www.ruby-forum.com/t/feature-request-for-access-log-stdout/244080/6 "2016-02-18T15:03:33Z")

</div>

Hi Andrew.

Am 18-02-2016 10:16, schrieb Andrew H.:

> > > > > 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 [The Twelve-Factor App](http://12factor.net/logs)

[snipp]

> > What version of Docker are you running? If it is prior to 1.9 you are  
> > likely to hit his bug: [Permission denied on /dev/stderr · Issue #6880 · moby/moby · GitHub](https://github.com/docker/docker/issues/6880)

#### 

docker version  
Client:  
Version: 1.8.2-el7  
API version: 1.20  
Package Version: docker-1.8.2-10.el7.x86\_64  
Go version: go1.4.2  
Git commit: a01dc02/1.8.2  
Built:  
OS/Arch: linux/amd64

Server:  
Version: 1.8.2-el7  
API version: 1.20  
Package Version:  
Go version: go1.4.2  
Git commit: a01dc02/1.8.2  
Built:  
OS/Arch: linux/amd64

#### 

> Also, as Valentin mentioned. Performance of any application, not just  
> NGINX, that logs a lot of data is going to be terrible when you  
> actually manage to do this.

I have received some suggestions on haproxy list, which I will try.

> There are many flaws in the The Factor-Factor App document and whilst  
> it may work out for you backend services I wouldn’t recommend  
> following it too closely for any core infrastructure.

Well I assume that this document is written for apps not core infra 😉

BR Aleks

---

<div class="post-metadata">

**Author:** ![Aleksandar\_L](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/8edcca/32.png) [@Aleksandar\_L](https://www.ruby-forum.com/u/Aleksandar_L)\
**Post date:** [February 19, 2016, 9:42am UTC](https://www.ruby-forum.com/t/feature-request-for-access-log-stdout/244080/7 "2016-02-19T09:42:50Z")

</div>

On 19/02/2016 02:56, Aleksandar L. wrote:

> /tmp/nginx.conf:22  
> nginx: configuration file /tmp/nginx.conf test failed
> 
> Any plans to add this possibility or have I missed something?

Please check the following:

[nginx - Official Image | Docker Hub](https://hub.docker.com/_/nginx/), section “using environment variables in  
nginx configuration”. You will need nginx:1.9.10 docker tag or later.

–  
Konstantin P.

---

<div class="post-metadata">

**Author:** ![Aleksandar\_L](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/8edcca/32.png) [@Aleksandar\_L](https://www.ruby-forum.com/u/Aleksandar_L)\
**Post date:** [February 19, 2016, 12:57am UTC](https://www.ruby-forum.com/t/feature-request-for-access-log-stdout/244080/8 "2016-02-19T00:57:06Z")

</div>

Hi.

Am 18-02-2016 15:02, schrieb Aleksandar L.:

> Hi Andrew.
> 
> Am 18-02-2016 10:16, schrieb Andrew H.:

[snipp]

> Git commit: a01dc02/1.8.2  
> OS/Arch: linux/amd64
> 
> #### 
> 
> > Also, as Valentin mentioned. Performance of any application, not just  
> > NGINX, that logs a lot of data is going to be terrible when you  
> > actually manage to do this.
> 
> I have received some suggestions on haproxy list, which I will try.

I have try to setup the syslog entry with variables, but it looks to me  
that this not implemented.

sed -e’s/access\_log.\*/access\_log  
syslog:server=${NGINX\_TEST\_PORT\_8514\_UDP\_ADDR}:${NGINX\_TEST\_PORT\_8514\_UDP\_PORT};/’  
/etc/nginx/nginx.conf \> /tmp/nginx.conf

cat /tmp/nginx.conf

##### 

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

```

syslog:server=${NGINX\_TEST\_PORT\_8514\_UDP\_ADDR}:${NGINX\_TEST\_PORT\_8514\_UDP\_PORT};

```
 sendfile on;
 #tcp_nopush on;

 keepalive_timeout 65;

 #gzip on;

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

```

}

#### 

nginx -T -c /tmp/nginx.conf

nginx: [alert] could not open error log file: open()  
“/var/log/nginx/error.log” failed (13: Permission denied)  
2016/02/18 23:54:51 [warn] 12#12: the “user” directive makes sense only  
if the master process runs with super-user privileges, ignored in  
/tmp/nginx.conf:2  
2016/02/18 23:54:51 [emerg] 12#12: invalid port in syslog server  
“${NGINX\_TEST\_PORT\_8514\_UDP\_ADDR}:${NGINX\_TEST\_PORT\_8514\_UDP\_PORT}” in  
/tmp/nginx.conf:22  
nginx: configuration file /tmp/nginx.conf test failed

Any plans to add this possibility or have I missed something?

BR  
Aleks

---

<div class="post-metadata">

**Author:** ![Aleksandar\_L](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/8edcca/32.png) [@Aleksandar\_L](https://www.ruby-forum.com/u/Aleksandar_L)\
**Post date:** [February 21, 2016, 8:07am UTC](https://www.ruby-forum.com/t/feature-request-for-access-log-stdout/244080/9 "2016-02-21T08:07:32Z")

</div>

Hi.

Am 19-02-2016 09:42, schrieb Konstantin P.:

> On 19/02/2016 02:56, Aleksandar L. wrote:

[snipp env errors]

> > Any plans to add this possibility or have I missed something?
> 
> Please check the following:
> 
> [nginx - Official Image | Docker Hub](https://hub.docker.com/_/nginx/), section “using environment variables  
> in  
> nginx configuration”. You will need nginx:1.9.10 docker tag or later.

Thanks for the input 😉

Now I was able to create a more production ready setup for nginx and  
Openshift.

> **[GitHub - git001/nginx-osev3](https://github.com/git001/nginx-osev3)**
>
> Contribute to git001/nginx-osev3 development by creating an account on GitHub.

BR Aleks
