Access_log

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Is it possible to send logs to some program instead of file?
Documentation
(http://wiki.codemongers.com/NginxHttpLogModule#access_log) show only
one way (file).
Now we use ‘access_log /dev/stdout’ in configuration and run nginx via
‘nginx | program’ - but it is not elegant.


guzik
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHFJ/nt25UBlJ9LC4RAk4pAJ9TI6YZoK+HROoDYbhWoPN6EYUI+gCfeWGe
tQIzsg2zVzwGzIivTH0zpMQ=
=6iYI
-----END PGP SIGNATURE-----

On Tue, Oct 16, 2007 at 01:26:31PM +0200, Bart?omiej Syryjczyk wrote:

Is it possible to send logs to some program instead of file?
Documentation
(http://wiki.codemongers.com/NginxHttpLogModule#access_log) show only
one way (file).
Now we use ‘access_log /dev/stdout’ in configuration and run nginx via
‘nginx | program’ - but it is not elegant.

No, nginx does not support logging to pipe or syslog because of
perfomance
issues. Workarounds are /dev/stdout and mkfifo (but they are slow).

We use the following script to roll our nginx logs at midnight, we’ve
found it very reliable

#!/bin/bash

YEAR=date "+%Y"
MONTH=date "+%m"
DAY=date "+%d"

HOSTNAME=hostname -s

LOG_FILES=“access.log error.log images.log redirect.log ssl.log”

DATE=$YEAR/$MONTH/$DAY

REDBUBBLE_LOG_ROOT=/var/log/redbubble
NGINX_LOG_ROOT=$REDBUBBLE_LOG_ROOT/nginx

make path

mkdir -p $NGINX_LOG_ROOT/$DATE

touch and symlink in new log files

for FILE in $LOG_FILES; do
LOG_FILE=$NGINX_LOG_ROOT/$DATE/$HOSTNAME.$FILE
touch $LOG_FILE
ln -fs $LOG_FILE $NGINX_LOG_ROOT/$FILE
done

tell nginx to re-open its log files

kill -USR1 cat /var/run/nginx.pid

Cheers

Dave

Is it possible to send logs to some program instead of file?
Documentation
(http://wiki.codemongers.com/NginxHttpLogModule#access_log) show only
one way (file).
Now we use ‘access_log /dev/stdout’ in configuration and run nginx via
‘nginx | program’ - but it is not elegant.

No, nginx does not support logging to pipe or syslog because of perfomance
issues. Workarounds are /dev/stdout and mkfifo (but they are slow).

http://blog.pjkh.com/articles/2007/03/15/nginx-and-cronolog

But be sure to read the UPDATE at the bottom…

-philip

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