Udplogger and nginx

Hello there,

I am trying to use udplogger module to push httplogs into distant
server, the 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

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 www.fqdn.com;

access_udplog 172.31.x.x:514 main bare;
#udplog_priority local7.info;
udplog_tag 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

access_udplog on;

This needs to be replaced with
access_udplog ;

http://www.grid.net.ru/nginx/udplog.en.html

has more documentation.

-Umesh

Hi :slight_smile:

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

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

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs