nginx socketlog module

nginx socketlog module

An nginx module for logging http requests via TCP into syslog servers.

  • Language: C/C++
  • Released: Aug 8, 2012
    Last Update: Aug 6, 2012

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:

  • you can define multiple log destinations (syslog servers)
  • restarting nginx in order to rotate logs is not required anymore!

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.

Hide

Configuration directives

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;

Hide

Installation instructions

How to use

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
Hide

Example configuration file

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;
        }
    }
}
Hide

Configuration directives

socketlog

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.

access_socketlog

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;

You need to log-in or create an account
  • Create an account
  • Log-in
Please use your real name.
Activation link will be sent to this address.
Minimum 8 characters
Enter your password again

Clicking this button confirms you read and agreed to the terms of use and privacy policy.

X

Save your watchlist

Fill your details below to receive project updates from your watch list - including new versions, price changes and discounts.

I agree to the terms of use and privacy policy.

License » Free Download
or Get a quote

for customization or integration services

  • this is very useful to my daily works,
    but it compiled error with nginx 1.6.
    any update?
    P Patrick
    3 months ago, 0 comments
    Was this helpful?
    Flag
Post a comment

Or enter your name and Email
No comments have been posted yet.