Syslog patch and 0.7.x

Anyone know if the syslog patch works with 0.7.x?

Thanks.
-Joe

Just tried it myself and it doesn’t looks like it works against the
newer code. Is this patch maintained?

-Joe

On Thu, 3 Sep 2009 09:42:08 -0700

Joe W. wrote:

Just tried it myself and it doesn’t looks like it works against the
newer code. Is this patch maintained?

-Joe

Use this patch, http://bugs.gentoo.org/attachment.cgi?id=197180, it
should work for the late 0.7.x and 0.8 releases.

Can the webmaster update the syslog patch section to include this patch
as well?

Regards
Marlon

Awesome, thanks Marlon!

-Joe

On Thu, 03 Sep 2009 21:37:37 +0200

Marlon,

I am trying this patch again 0.7.61 and getting a build error:

make -f objs/Makefile
make[1]: Entering directory /root/nginx-0.7.61' gcc -c -O -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Wunused-function -Wunused-variable -Wunused-value -Werror -g -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \ -o objs/src/core/nginx.o \ src/core/nginx.c gcc -c -O -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Wunused-function -Wunused-variable -Wunused-value -Werror -g -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \ -o objs/src/core/ngx_log.o \ src/core/ngx_log.c cc1: warnings being treated as errors src/core/ngx_log.c: In function 'ngx_error_log': src/core/ngx_log.c:456: error: pointer targets in assignment differ in signedness make[1]: *** [objs/src/core/ngx_log.o] Error 1 make[1]: Leaving directory/root/nginx-0.7.61’ make: *** [build] Error 2

Any ideas?

-Joe

On Thu, 03 Sep 2009 21:37:37 +0200

Joe W. wrote:

-Wpointer-arith -Wno-unused-parameter -Wunused-function
-Wunused-variable -Wunused-value -Werror -g -I src/core -I src/event
-I src/event/modules -I src/os/unix -I objs \ -o
objs/src/core/ngx_log.o \ src/core/ngx_log.c cc1: warnings being
treated as errors src/core/ngx_log.c: In function ‘ngx_error_log’:
src/core/ngx_log.c:456: error: pointer targets in assignment differ in
signedness make[1]: *** [objs/src/core/ngx_log.o] Error 1 make[1]:
Leaving directory `/root/nginx-0.7.61’ make: *** [build] Error 2

I created this patch on a gentoo system and haven’t tested building it
without ebuild and emerge. It seems that building it from scratch uses
gcc -Wall being much more strict.

If you want to test the test quickly open up objs/Makefile and remove
the -Wall and -Werro in the CFLAGS.

I’ll try to take a look tomorrow to make the patch working with more
strict gcc rules.

Regards
Marlon

I got it to compile with the patch by removing “-Wall” and “-Werr”
references from “auto/cc/gcc” but it doesn’t seem to log anything. I
still see output to the normal nginx logs but nothing to my rsyslog
server. Is there any additional configuration or switches I need to get
this rolling? I did the configure with ‘–with-syslog’.

Thanks.
-Joe

On Thu, 03 Sep 2009 23:32:35 +0200

I am getting:

“[emerg]: unknown log format “main” in /opt/nginx/conf/nginx.conf”

Any ideas? Something wrong with my install/build?

-Joe

On Fri, 04 Sep 2009 17:05:56 +0200

Joe W. wrote:

I got it to compile with the patch by removing “-Wall” and “-Werr”
references from “auto/cc/gcc” but it doesn’t seem to log anything. I
still see output to the normal nginx logs but nothing to my rsyslog
server. Is there any additional configuration or switches I need to get
this rolling? I did the configure with ‘–with-syslog’.

Thanks.
-Joe

I just use the following in nginx (any file will do because it wouldn’t
use it):

access_log /var/log/nginx/access_fifo main;
error_log /var/log/nginx/error_fifo error;

and in syslog-ng (useful part):

filter f_nginx_access { program(“nginx”) and level(notice); };
filter f_nginx_error { program(“nginx”) and level(crit); };

destination nginx_access { tcp(“loghost”);
file("/var/log/nginx/access_log"); };
destination nginx_error { tcp(“loghost”);
file("/var/log/nginx/error_log"); };

log { source(src); filter(f_nginx_access); destination(nginx_access); };
log { source(src); filter(f_nginx_error); destination(nginx_error); };

Regards
Marlon

Joe W. wrote:

I am getting:

“[emerg]: unknown log format “main” in /opt/nginx/conf/nginx.conf”

Any ideas? Something wrong with my install/build?

I use this config in my nginx.conf:

log_format main '$host $remote_addr $http_x_forwarded_for - $remote_user
[$time_local] $request_time ’ '"$request" $status $bytes_sent ';

If you anymore questions perhaps it’s best to ask them outside this list
without bothering other people, I’ll be glad to help you.

Regards
Marlon

Nam wrote:

I have noticed that the patch on the gentoo site no longer works with the latest version of nginx. Does anyone know where you get an updated version of the patch?

Posted at Nginx Forum: Re: syslog patch and 0.7.x

I applied the patch I posted on
http://bugs.gentoo.org/attachment.cgi?id=197180 to both 0.7.64 and
0.8.26 and both worked.

Regards
Marlon

I have noticed that the patch on the gentoo site no longer works with
the latest version of nginx. Does anyone know where you get an updated
version of the patch?

Posted at Nginx Forum:

2009/11/17 Nam [email protected]:

I had to make a change to the patch in order to get it working…

+if test -n “$USE_SYSLOG”; then

instead of

+if [[ “${USE_SYSLOG}” == “YES” ]]; then

which got things working for me.

Indeed, sh is not bash, that’s why I submitted this patch against 0.6.x:
http://wiki.nginx.org/File:Syslog_0.6.35_sh_is_not_bash.patch

We should probably do the same for 0.7.x…

Jean-Baptiste Q.

I had to make a change to the patch in order to get it working…

+if test -n “$USE_SYSLOG”; then

instead of

+if [[ “${USE_SYSLOG}” == “YES” ]]; then

which got things working for me.

Posted at Nginx Forum: