udplogger and nginx

Xavier Beaudouin kiwi at oav.net
Mon Dec 12 17:24:42 UTC 2011


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 
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 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



More information about the nginx mailing list