Logging via syslog and pipe is supported in tengine. To use it, you should enable the syslog module first:
./configure --with-syslog
The syslog module can talk directly to syslogd or syslog-ng.
og sampling is also possible in tengine to reduce the count of log records.
Basically, you can use it as same as nginx's 'access_log', and you can write down 'ratio' and 'buffer' after 'format' in any order. Moreover, there are several enhancements:
It's compatible with the log_file parameter, while three new log media types are supported:
file:/path/to/file syslog:facility[:[loglevel][:[target_ip:[target_port] | target_udgram_addr][:ident]]] "pipe:/path/to/exec [param1 param2 ...]"
Support logging via syslog (UDP).
facility := auth | authpriv | cron | daemon | ftp | kern | lpr | mail | mark
| news | security | syslog | user | uucp | local0 | local1 | local2
| local3 | local4 | local5 | local6 | local7
loglevel := crit | err | error | emerg | panic | alert | warn | warning
| info | notice | debug
The default loglevel is 'info'.
target_ip[:target_port]:
The IP address and port of destination server. The default port is 514.
And UDP is the only supported protocol.
target_udgram_addr:
Specify the address of unix_dgram. The default address is "/dev/log".
UNIX DGRAM is the only supported protocol.
ident:
Specify the mark for your application.
Here are a few examples:
syslog:user:info:127.0.0.1:514:identLog to 127.0.0.1:514, with facility 'user', level 'info' and ident 'ident'.
May 4 15:44:15 local ident[26490]: XXXXXXXX
syslog:auth:err:10.232.4.28::identLog to 10.232.4.28:514, with facility 'auth', level 'err' and ident 'ident'.
syslog:user:info:/dev/log:identLog to local Unix dgram(/dev/log), with facility 'user', level 'info' and ident 'ident'.
syslog:user::/dev/log:identLog to local Unix dgram(/dev/log), with facility 'user', default level 'info' and ident 'ident'.
syslog:user:info::identLog to default local Unix dgram(/dev/log), with facility 'user', level 'info' and ident 'ident'.
syslog:cron:debug:/dev/logLog to local Unix dgram(/dev/log), with facility 'cron', level 'debug' and default ident 'NGINX'.
May 4 15:44:15 local NGINX[26490]: XXXXXXXX
syslog:user::127.0.0.1Log to 127.0.0.1:514, with facility 'user', default level 'info' and default ident 'NGINX'.
syslog:user:debugLog to default local Unix dgram(/dev/log), with facility 'user', level 'debug' and default ident 'NGINX'.
syslog:userLog to default local Unix dgram(/dev/log), with facility 'user', default level 'info' and default ident 'NGINX'.
Since there may be space characters, the pipe name should be wrapped by quotes.
The privilege of the pipe is the same the worker process (default user and group are 'nobody').
Specify a sampling ratio.
For example, ratio=0.0001, which means tengine will log only once in every 10000 records.
This parameter must be explicitly specified, e.g. ratio=1, if you want to use the 'buffer' parameter.
Syslog and pipe are also supported, which is similar to 'access_log'.
The retry interval in case tengine fails to connect to the remote syslog server.