This is a high-performance nginx module for logging http requests via TCP into syslog.
Ever wanted to centralize your log files on one machine or organize your logfiles better? This module is for you!
Smooth integration of this module with nginx server gives the best performance possible. This module links together a fast web server with a well-know and verified logging server.
Main advantages of this module:
The module keeps persistent connections to syslog servers and reconnecting if necessary. Once the connection is dropped, the module accumulates log messages in a queue. Once the connection goes up again, the modules flushed accumulated data into the servers. This means that you can restart logging server, without worrying about nginx!
The module keeps persistant connections to BSD syslog servers, reconnecting if necessary.
Developed and tested with nginx version 1.3.x, might work with earlier as well.
syntax: socketlog <peer name> <hostname>[:<port>]
default: none
severity: mandatory
context: main configuration file
Specifies the name of a log peer and it's BSD syslog hostname. Once specified, the peer name can be used in access_socketlog directives described below. hostname can be both domain name and IP address of a destination BSD syslog host. Syslog server must listen on TCP port 514 of this host.
syntax: access_socketlog <off>|<peer name> [<log format> [bare]]
default: none
severity: optional
context: http, server, location
Enables or disables logging into specified socketlog peer. Once enabled at certain level, same logging settings are inherited by subsequent levels. off argument disables logging into socket for specific location. Multiple peers are allowed at the same location. Log messages are then sent into all specified peers. bare specifies that no BSD syslog header must be used.
Example: access_socketlog test combined bare;
Download sources and unpack the archive:
$ unzip nginx-socketlog-module-1.0.0.zip
Configure nginx with additional module:
cd [path to nginx installation]
./configure --add-module=[path to socketlog module]
make
make install
error_log logs/error.log debug;
events {
worker_connections 1024;
}
socketlog test localhost;
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name localhost;
access_socketlog test;
location /no_logging {
access_socketlog off;
}
}
}
syntax: socketlog <peer name> <hostname>[:<port>]
default: none
severity: mandatory
context: main configuration file
Specifies the name of a log peer and it's BSD syslog hostname. Once specified, the peer name can be used in access_socketlog directives described below. hostname can be both domain name and IP address of a destination BSD syslog host. Syslog server must listen on TCP port 514 of this host.
syntax: access_socketlog <off>|<peer name> [<log format> [bare]]
default: none
severity: optional
context: http, server, location
Enables or disables logging into specified socketlog peer. Once enabled at certain level, same logging settings are inherited by subsequent levels. off argument disables logging into socket for specific location. Multiple peers are allowed at the same location. Log messages are then sent into all specified peers. bare specifies that no BSD syslog header must be used.
Example: access_socketlog test combined bare;
Questions & Comments