# Udplogger and nginx

**URL:** <https://www.ruby-forum.com/t/udplogger-and-nginx/214801>\
**Category:** NGINX\
**Created:** [December 12, 2011, 6:25pm UTC](https://www.ruby-forum.com/t/udplogger-and-nginx/214801 "2011-12-12T18:25:50Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![dubstep](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/cdc98d/32.png) [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Post date:** [December 12, 2011, 6:25pm UTC](https://www.ruby-forum.com/t/udplogger-and-nginx/214801/1 "2011-12-12T18:25:50Z")

</div>

Hello there,

I am trying to use udplogger module to push httplogs into distant  
server, the [GitHub - vkholodkov/nginx-udplog-module: Implementation of logging using BSD Syslog Protocol for nginx (RFC 3164)](https://github.com/vkholodkov/nginx-udplog-module) module  
version.

Problem I have is that I cannot find “real life” example on how to use  
this module, also how to make it send syslog stuff into my distant  
syslog system.

The 1.0.0 plain module seems to segfault (mostly because it seems to  
try to send data to the distant syslog system, but since it is not yet  
correctly configured, I don’t have any clue about that).

I may miss something, since the readme of this module is quite small…

According to

> <https://github.com/vkholodkov/nginx-udplog-module/blob/master/ngx_http_udplog_module.c>

I have 3 configuration directives :

```
 { ngx_string("access_udplog"),

```

NGX\_HTTP\_MAIN\_CONF|NGX\_HTTP\_SRV\_CONF|NGX\_HTTP\_LOC\_CONF|NGX\_HTTP\_LIF\_CONF  
|NGX\_HTTP\_LMT\_CONF|NGX\_CONF\_TAKE1234,  
ngx\_http\_udplog\_set\_log,  
NGX\_HTTP\_LOC\_CONF\_OFFSET,  
0,  
NULL },

```
 { ngx_string("udplog_priority"),

```

NGX\_HTTP\_MAIN\_CONF|NGX\_HTTP\_SRV\_CONF|NGX\_HTTP\_LOC\_CONF|NGX\_CONF\_TAKE12,  
ngx\_http\_udplog\_set\_priority,  
NGX\_HTTP\_LOC\_CONF\_OFFSET,  
0,  
NULL },

```
 { ngx_string("udplog_tag"),

```

NGX\_HTTP\_MAIN\_CONF|NGX\_HTTP\_SRV\_CONF|NGX\_HTTP\_LOC\_CONF|NGX\_CONF\_TAKE1,  
ngx\_http\_udplog\_set\_tag,  
NGX\_HTTP\_LOC\_CONF\_OFFSET,  
offsetof(ngx\_http\_udplog\_conf\_t, tag),  
NULL },

I have specified them into my nginx.conf but doesn’t help.

Seems that :

if(ulcf-\>off) {  
return NGX\_OK;  
}

the “off” variable is always to off so the module is not active.

Now I don’t know how to make this ulcf-\>off to 0 instead of 1, since  
nginx.conf look like what this modules needs to make it work.

Any hints or help ?

For information, my nginx.conf :

user nobody;  
worker\_processes 1;

#error\_log logs/error.log;  
error\_log logs/error.log notice;  
#error\_log logs/error.log info;  
#error\_log logs/error.log debug;

#pid logs/nginx.pid;

events {  
use kqueue;  
worker\_connections 4096;  
}

http {

## Hashing virtual hosts

server\_names\_hash\_max\_size 1024;  
server\_names\_hash\_bucket\_size 128;

## MIME Types

include mime.types;  
default\_type application/octet-stream;

## Log formats

log\_format main '$remote\_addr - $remote\_user [$time\_local] $request  
’  
'“$status” $body\_bytes\_sent “$http\_referer” ’  
‘“$http\_user\_agent” “$http\_x\_forwarded\_for”’;

keepalive\_timeout 55;  
sendfile on;  
tcp\_nopush on;  
tcp\_nodelay on;

## UDP Log

access\_udplog on;  
udplog\_tag main;

# Main Server

server {  
udplog\_tag default;  
#access\_udplog off;  
access\_log off;  
listen \*:8080;  
listen [::]:8080;  
server\_name \_;  
server\_name\_in\_redirect off;  
location / {  
index index.html;  
root /http/default;  
}  
}

# Virtual Servers

server {  
listen \*:8080;  
listen [::]:8080;  
server\_name [fqdn.com](http://fqdn.com) [www.fqdn.com](http://www.fqdn.com);

access\_udplog 172.31.x.x:514 main bare;  
#udplog\_priority local7.info;  
udplog\_tag [fqdn.com](http://fqdn.com);  
access\_log off;

index index.php index.html index.htm;  
location / {  
root /http/fqdn.com;  
}

#error\_page 500 502 503 504 /50x.html;  
location = /50x.html {  
root /hosting/http/default;  
}

# serve static files directly

location ~\* .(jpg|jpeg|gif|css|png|js|ico|html)$ {  
#access\_log off;  
expires max;  
}

# pass the PHP scripts to php-fpm server listening on 127.0.0.1:9000

location ~ .php$ {  
fastcgi\_pass 127.0.0.1:9000;  
fastcgi\_index index.php;  
fastcgi\_param SCRIPT\_FILENAME /http/fqdn.com$fastcgi\_script\_name;  
include fastcgi\_params;  
}

location ~ /.ht {  
deny all;  
}  
}

}

–  
Xavier Beaudouin

---

<div class="post-metadata">

**Author:** ![Xavier\_Beaudouin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/x/8dc957/32.png) [@Xavier\_Beaudouin](https://www.ruby-forum.com/u/Xavier_Beaudouin)\
**Post date:** [December 12, 2011, 10:11pm UTC](https://www.ruby-forum.com/t/udplogger-and-nginx/214801/2 "2011-12-12T22:11:52Z")

</div>

> > access\_udplog on;

This needs to be replaced with  
access\_udplog ;

[http://www.grid.net.ru/nginx/udplog.en.html](http://www.grid.net.ru/nginx/udplog.en.html)

has more documentation.

-Umesh

---

<div class="post-metadata">

**Author:** ![Xavier\_Beaudouin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/x/8dc957/32.png) [@Xavier\_Beaudouin](https://www.ruby-forum.com/u/Xavier_Beaudouin)\
**Post date:** [December 12, 2011, 10:59pm UTC](https://www.ruby-forum.com/t/udplogger-and-nginx/214801/3 "2011-12-12T22:59:35Z")

</div>

Hi 🙂

Le 12 dc. 2011 22:11, Umesh Sirsiwal a crit :

> > > access\_udplog on;
> 
> This needs to be replaced with  
> access\_udplog ;
> 
> [http://www.grid.net.ru/nginx/udplog.en.html](http://www.grid.net.ru/nginx/udplog.en.html)
> 
> has more documentation.

Yeah… doesn’t work as well :

2011/12/12 22:57:48 [debug] 80726#0: \*6 tcp\_nopush  
2011/12/12 22:57:48 [debug] 80726#0: \*6 sendfile: 0, @0 10:10  
2011/12/12 22:57:48 [debug] 80726#0: \*6 http write filter  
0000000000000000  
2011/12/12 22:57:48 [debug] 80726#0: \*6 http copy filter: 0  
“/index.html?”  
2011/12/12 22:57:48 [debug] 80726#0: \*6 http finalize request: 0,  
“/index.html?” a:1, c:2  
2011/12/12 22:57:48 [debug] 80726#0: \*6 http request count:2 blk:0  
2011/12/12 22:57:48 [debug] 80726#0: \*6 http finalize request: -4,  
“/index.html?” a:1, c:1  
2011/12/12 22:57:48 [debug] 80726#0: \*6 http request count:1 blk:0  
2011/12/12 22:57:48 [debug] 80726#0: \*6 http close request  
2011/12/12 22:57:48 [debug] 80726#0: \*6 http log handler  
2011/12/12 22:57:48 [debug] 80726#0: \*6 http udplog handler  
2011/12/12 22:57:48 [debug] 80726#0: \*6 run cleanup: 00000008011FF6F8  
2011/12/12 22:57:48 [debug] 80726#0: \*6 file cleanup: fd:10  
2011/12/12 22:57:48 [debug] 80726#0: \*6 free: 00000008011FF000, unused:  
1872  
2011/12/12 22:57:48 [debug] 80726#0: \*6 close http connection: 3  
2011/12/12 22:57:48 [debug] 80726#0: \*6 reusable connection: 0  
2011/12/12 22:57:48 [debug] 80726#0: \*6 free: 0000000800E13400  
2011/12/12 22:57:48 [debug] 80726#0: \*6 free: 0000000800E21C00  
2011/12/12 22:57:48 [debug] 80726#0: \*6 free: 0000000800E7C200, unused:  
8  
2011/12/12 22:57:48 [debug] 80726#0: \*6 free: 0000000800E7C300, unused:  
128  
2011/12/12 22:57:48 [debug] 80726#0: timer delta: 440  
2011/12/12 22:57:48 [debug] 80726#0: posted events 0000000000000000

As you see, “http udplog handler is started, but…” doesn’t seems to be  
used.

Xavier

---

<div class="post-metadata">

**Author:** ![Xavier\_Beaudouin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/x/8dc957/32.png) [@Xavier\_Beaudouin](https://www.ruby-forum.com/u/Xavier_Beaudouin)\
**Post date:** [December 12, 2011, 11:17pm UTC](https://www.ruby-forum.com/t/udplogger-and-nginx/214801/4 "2011-12-12T23:17:31Z")

</div>

Looking at the code, I don’t see any log withing actual udplog handler.  
So it may be working. You may be able to check on your syslog server or  
using syslog.

-Umesh
