access_log
Dave Cheney
dave at cheney.net
Tue Oct 16 19:07:40 MSD 2007
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
On 17/10/2007, at 12:50 AM, Igor Sysoev wrote:
> 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).
>
>
> --
> Igor Sysoev
> http://sysoev.ru/en/
>
More information about the nginx
mailing list